Skip to content

Commit 66c9ca6

Browse files
committed
set the "tasks_by_state" method as optional
Driver API was changed with the new requirement in 75c4708: the new method "tasks_by_state" must be defined in a queue driver now. We want to be user-friendly, so we allow user to work without implementing this method in the customer driver. Part of #126
1 parent c844e06 commit 66c9ca6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

queue/abstract.lua

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,12 @@ local function tube_release_all_tasks(tube)
7575
return
7676
end
7777

78+
-- Custom drivers may not have an implementation of
79+
-- the "tasks_by_state" method.
80+
if tube.raw['tasks_by_state'] == nil then
81+
return
82+
end
83+
7884
log.info(prefix .. 'releasing all taken task (may take a while)')
7985
local released = 0
8086
for _, task in tube.raw:tasks_by_state(state.TAKEN) do

0 commit comments

Comments
 (0)