You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm currently using DelayedJob with this custom plugin that allows me to access the provider_job_id from within the perform method of a job:
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
The Sidekiq adapter in Rails also does something similar:
I'm intending to migrate to Solid Queue but just wondered if this is an option currently? From looking at the source I don't seen the job id being passed in. I have two use cases:
Keeping track of a job that generates another job at the end of its run (so a kind of recurring job configurable by the user). I store the job_id in the database so that I can destroy that job and schedule a new job if the user changes the time it should run.
Skipping the execution of a job if the object passed into the job has an updated_at that is greater than the job's created_at. This signals that there's now a newer job scheduled that should take precedence. I use this for WebPush notifications.
The text was updated successfully, but these errors were encountered:
I'm currently using
DelayedJob
with this custom plugin that allows me to access theprovider_job_id
from within theperform
method of a job:The Sidekiq adapter in Rails also does something similar:
https://github.com/rails/rails/pull/25961/files#diff-e1ee600ca5fd100da20810ef5acbab89546064fc323c7b1e6bdb6ed5e681a9d3L40
I'm intending to migrate to Solid Queue but just wondered if this is an option currently? From looking at the source I don't seen the job id being passed in. I have two use cases:
job_id
in the database so that I can destroy that job and schedule a new job if the user changes the time it should run.updated_at
that is greater than the job'screated_at
. This signals that there's now a newer job scheduled that should take precedence. I use this for WebPush notifications.The text was updated successfully, but these errors were encountered: