Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

access provider_job_id inside ActiveJob #1118

Open
senid231 opened this issue Jul 2, 2020 · 1 comment
Open

access provider_job_id inside ActiveJob #1118

senid231 opened this issue Jul 2, 2020 · 1 comment

Comments

@senid231
Copy link

senid231 commented Jul 2, 2020

looks like provider_job_id is nil inside active_job instance during perform (and related callbacks)

but fix is quiet simple
just put following into initializer

class Delayed::ActiveJobPlugin < Delayed::Plugin
  callbacks do |lifecycle|
    lifecycle.before(:invoke_job) do |job|
      job.payload_object.job_data['provider_job_id'] = job.id if job.payload_object.respond_to?(:job_data)
    end
  end
end

Delayed::Worker.plugins << Delayed::ActiveJobPlugin

I want to keep it here for future generation
maybe add to README?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants