disable delayed job worker via environment variable

81 views
Skip to first unread message

Tom Herrick

unread,
May 1, 2018, 10:28:25 PM5/1/18
to delayed_job
We run multiple servers for our application. I'm looking for a way to disable delayed-job workers on a given server via an environment variable while we are still building and configuring that server. I'm imagining setting something in the delayed-job initializer that tells the worker not to try to process any jobs. Something like this...

Delayed::Worker.enabled = false if ENV['DISABLE_DELAYED_JOB'] == 'true'

I don't see any settings that would accomplish that, but I'm wondering if I'm missing something. Is there a way to tell a worker to only process certain queues? I could use that to give the worker a bogus queue name so it would never find any work to do.

Alternatively, is this something I can accomplish with lifecycle hooks or plugins to tell the worker not to reserve or process any jobs.

David Genord II

unread,
May 1, 2018, 10:31:33 PM5/1/18
to delay...@googlegroups.com
Why do you want processes running purposefully told to do nothing?

David Genord II

--

---
You received this message because you are subscribed to the Google Groups "delayed_job" group.
To unsubscribe from this group and stop receiving emails from it, send an email to delayed_job+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Tom Herrick

unread,
May 2, 2018, 5:52:08 AM5/2/18
to delayed_job
It's because of the way we provision new servers. We build them up partially configured, but don't immediately want them to join the load balancer or start processing jobs. Part of building them up is to setup the init.d scripts (which start delayed-job on reboot) and to do a capistrano deploy (which includes a delayed-job restart), so preventing them from starting delayed-job at all would require us to add hooks in multiple spots. It seemed cleaner to have the process running but configured not to do any work until we were ready to really launch the new server.

-Tom
To unsubscribe from this group and stop receiving emails from it, send an email to delayed_job...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages