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
2 changes: 1 addition & 1 deletion app/models/solid_queue/claimed_execution.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def failed_with(error)

private
def execute
ActiveJob::Base.execute(job.arguments)
ActiveJob::Base.execute(job.arguments.merge("provider_job_id" => job.id))
Result.new(true, nil)
rescue Exception => e
Result.new(false, e)
Expand Down
5 changes: 5 additions & 0 deletions test/dummy/app/jobs/provider_job_id_job.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class ProviderJobIdJob < ApplicationJob
def perform
JobBuffer.add "provider_job_id: #{provider_job_id}"
end
end
8 changes: 8 additions & 0 deletions test/models/solid_queue/claimed_execution_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,14 @@ class SolidQueue::ClaimedExecutionTest < ActiveSupport::TestCase
assert job.reload.failed?
end

test "provider_job_id is available within job execution" do
job = ProviderJobIdJob.perform_later
claimed_execution = prepare_and_claim_job job
claimed_execution.perform

assert_equal "provider_job_id: #{job.provider_job_id}", JobBuffer.last_value
end

private
def prepare_and_claim_job(active_job, process: @process)
job = SolidQueue::Job.find_by(active_job_id: active_job.job_id)
Expand Down