Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions test/dummy/app/jobs/continuable_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class ContinuableJob < ApplicationJob

def perform(result, pause: 0)
step :step_one do
result.update!(queue_name: queue_name, status: "started", value: "step_one")
sleep pause if pause > 0
result.update!(queue_name: queue_name, status: "stepped", value: "step_one")
end
Expand Down
5 changes: 4 additions & 1 deletion test/integration/continuation_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,10 @@ def setup
test "continuable job can be interrupted and resumed" do
job = ContinuableJob.perform_later(@result, pause: 0.5.seconds)

sleep 0.2.seconds
# Wait for step_one to have started before signaling TERM, so the signal
# always arrives while the job is paused inside step_one and the interruption
# lands between the two steps
wait_while_with_timeout(3.seconds) { !JobResult.exists?(status: "started", value: "step_one") }
signal_process(@pid, :TERM)

wait_for_jobs_to_be_released_for(2.seconds)
Expand Down
Loading