Search code examples
ruby-on-railsmongoiddelayed-job

Update run_at for a delayed_job queue


My application runs some jobs using delayed_job. It is a rails application running with mongoid. When an already queued job suddenly needs to change its schedule to start, can I just update the "run_at" field from the delayed_jobs collection for that specific job? Is there any better best practice?

Thank you


Solution

  • I wouldn't recommend updating the run_at attribute as it would mean touching the internals of a library.

    Instead, consider setting the correct priority and using named queues on the delay method call.

    If you use named queues, you can have a new thread dedicated to running such queues.