custom_announcement scheduler 未取得 lockfile 鎖時跳過排程,修正 NotRunningError 導致 worker 開機失敗無限重啟
This commit is contained in:
parent
9733317e48
commit
1f14904c65
|
|
@ -3,7 +3,9 @@ require 'rufus-scheduler'
|
|||
unless defined?(Rails::Console) || Rails.env.test? || File.split($0).last == 'rake'
|
||||
scheduler = Rufus::Scheduler.new(lockfile: Rails.root.join('tmp', 'custom_bulletin_scheduler.lock').to_s)
|
||||
|
||||
scheduler.cron '43 2 * * *' do
|
||||
CustomBulletin.where(is_preview: true).destroy_all
|
||||
if scheduler.up?
|
||||
scheduler.cron '43 2 * * *' do
|
||||
CustomBulletin.where(is_preview: true).destroy_all
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in New Issue