Skip to content

Commit b969a72

Browse files
feat: fixing tests
1 parent 407f3e0 commit b969a72

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

app/models/solid_queue/recurring_task.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,14 @@ def enqueue(at:)
8686
end
8787
rescue RecurringExecution::AlreadyRecorded
8888
payload[:skipped] = true
89+
# The execution for this task and run time was already recorded by another
90+
# thread or process. Lookup the existing execution so we can still expose
91+
# the Active Job identifier in the instrumentation payload. This allows
92+
# consumers (and our test-suite) to reliably correlate the event with the
93+
# previously enqueued job even when it is reported as skipped.
94+
if (existing_execution = SolidQueue::RecurringExecution.find_by(task_key: key, run_at: at))
95+
payload[:active_job_id] = existing_execution.job&.active_job_id
96+
end
8997
false
9098
rescue Job::EnqueueError => error
9199
payload[:enqueue_error] = error.message

0 commit comments

Comments
 (0)