Reputation: 9018
Ok,a simple question. I want to change sleep time for my delayed job worker. How do I do it in the current version?
I've found out two suggestions for this:
Delayed::Worker.const_set("SLEEP", sleep_time_in_seconds)
and
Delayed::Worker.sleep_delay = sleep_time_in_seconds
.
What's the difference between those two?
Thanks
Upvotes: 1
Views: 2076
Reputation: 53349
It depends on what version of delayed_job you are using. If you are using the tobi
version (https://github.com/tobi/delayed_job) you should set the constant:
Delayed::Worker.const_set('SLEEP', sleep_time_in_seconds)
If you don't know what version you are using, the tobi
version is most likely it (you can check the delayed_job.gemspec
file in your plugin directory to confirm; it will have something like s.homepage = <git-page-of-your-version>
).
If you are using the collectiveidea
version (https://github.com/collectiveidea/delayed_job) you should use the attribute setter:
Delayed::Worker.sleep_delay = sleep_time_in_seconds
If you are using another version, consult the README
for that version.
Upvotes: 3