3
比方說,這是我的工作人員:如何使Bluepill重啓Resque工人只能達到安全狀態後
class FooWorker
@queue = :foo
def self.perform
User.all.each do |u|
...
Do Long Operations (Unsafe to kill)
...
# Here it's safe to break the worker and restart
end
end
end
我與Resque調度入隊這一點,這是我的Bluepill的conf:
...
app.process(process_name) do |process|
process.group = "resque"
process.start_command = "rake environment resque:work QUEUE=foo RAILS_ENV=production"
...
process.stop_signals = [:quit, 5.seconds, :term, 1.minute, :kill]
process.daemonize = true
process.start_grace_time = 30.seconds
process.stop_grace_time = 80.seconds
process.monitor_children do |child_process|
child_process.stop_command = "kill -QUIT {{PID}}"
child_process.checks :mem_usage, :every => 30.seconds, :below => 500.megabytes, :times => [3,4], :fires => :stop
end
end
....
我想使Bluepill或Resque等到它到達「安全」區塊才能重新啓動或關閉。如何實現這一目標?
是你的長期操作的東西,可以被放入一個數據庫事務,因此,如果殺了他們讓系統處於清潔狀態?不是你正在尋找的答案,但也許這是一種替代方法? –
您是否找到解決方案? – Robert