Skip to content

Commit 4c75a01

Browse files
committed
Support inline mode for dispatcher
We just need to define a condition for all work to be finished. This comes handy in tests.
1 parent 7a5d43e commit 4c75a01

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

lib/solid_queue/dispatcher.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ def unload_recurring_schedule
5151
recurring_schedule.unload_tasks
5252
end
5353

54+
def all_work_completed?
55+
SolidQueue::ScheduledExecution.none? && recurring_schedule.empty?
56+
end
57+
5458
def set_procline
5559
procline "waiting"
5660
end

lib/solid_queue/dispatcher/recurring_schedule.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ def initialize(tasks)
1111
@scheduled_tasks = Concurrent::Hash.new
1212
end
1313

14+
def empty?
15+
configured_tasks.empty?
16+
end
17+
1418
def load_tasks
1519
configured_tasks.each do |task|
1620
load_task(task)

0 commit comments

Comments
 (0)