开发者

Can you alter the polling time interval (5 seconds) for delayed_job worker?

Delayed job is great, but I would like to change its timer interval to be more frequent (every 2 second) to meet my special need.

Is there a confi开发者_运维技巧g or hard-coding anywhere to change it?


With DJ 3.0 you can add this to the config/initializers/delayed_job_config.rb file:

Delayed::Worker.sleep_delay = 2


Try setting

Delayed::Worker.const_set("SLEEP", 2)

in your config/initializers/delayed_job_config.rb file.


Sure, just go to RAILS_ROOT/vendor/plugins/delayed_job/lib/delayed/worker.rb, look for the line

self.sleep_delay = 5

and change it to

self.sleep_delay = 2

or whatever you'd like

On an earlier version of DJ I set this to as little as 0.1 so that the jobs in the queue get picked up for processing almost instantly and it works just fine.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜