tarantool / queue

Create task queues, add and take jobs, monitor failed tasks
Other
237 stars 52 forks source link

utubettl: possible bug with on_task_change? #100

Open iskandarov-egor opened 5 years ago

iskandarov-egor commented 5 years ago

When releasing/deleting a task in utubettl, the code finds a "neighbour" task - a task with the same utube field that is in READY state. It then notifies the framework that this neighbour task is now available for taking, by calling on_task_change.

local function process_neighbour(self, task, operation)
    self:on_task_change(task, operation)
    if task ~= nil then
        local neighbour = self.space.index.utube:min{state.READY, task[i_utube]}
        if neighbour ~= nil and neighbour[i_status] == state.READY then
            self:on_task_change(neighbour)
        end
    end
    return task
end

A possible bug is that this neighbour task may not be the one with the lowest priority, because the priority field not in the "utube" index. Currently, the framework wakes up a consumer fiber, but does not look at the particular task being passed to on_task_change, so it doesn't matter.

Is this a bug?