Skip to content

Commit 7f941a5

Browse files
committed
adding 100ms minimum delay time for recurring tasks
1 parent 0e633ff commit 7f941a5

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

app/models/solid_queue/recurring_task.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def create_or_update_all(tasks)
4848
end
4949

5050
def delay_from_now
51-
[ (next_time - Time.current).to_f, 0 ].max
51+
[ (next_time - Time.current).to_f, 0.1 ].max
5252
end
5353

5454
def next_time

test/integration/instrumentation_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ class InstrumentationTest < ActiveSupport::TestCase
327327

328328
events = subscribed("enqueue_recurring_task.solid_queue") do
329329
schedulers.each(&:start)
330-
sleep 1.01
330+
wait_while_with_timeout(1.1.second) { SolidQueue::RecurringExecution.count < 2 }
331331
schedulers.each(&:stop)
332332
end
333333

0 commit comments

Comments
 (0)