Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions queue/abstract/driver/utubettl.lua
Original file line number Diff line number Diff line change
Expand Up @@ -293,8 +293,8 @@ end
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
local neighbour = self.space.index.utube:select({state.READY, task[i_utube]}, {limit=1})[1]
if neighbour ~= nil then
self:on_task_change(neighbour)
end
end
Expand All @@ -304,10 +304,16 @@ end
-- delete task
function method.delete(self, id)
local task = self.space:get(id)
self.space:delete(id)
if task ~= nil then
local is_taken = task[i_status] == state.TAKEN
self.space:delete(id)
task = task:transform(i_status, 1, state.DONE)
return process_neighbour(self, task, 'delete')
if is_taken then
return process_neighbour(self, task, 'delete')
else
self:on_task_change(task, 'delete')
return task
end
end
self:on_task_change(task, 'delete')
end
Expand Down