delete preview bulletins at 02:43 daily, using ruby process rather than cronjob

This commit is contained in:
EricTYL 2019-10-09 16:43:37 +08:00
parent 585397f32f
commit 7471f40e3f
2 changed files with 11 additions and 0 deletions

View File

@ -16,4 +16,6 @@ Gem::Specification.new do |s|
s.files = Dir["{app,config,db,lib}/**/*", "MIT-LICENSE", "Rakefile", "README.rdoc"]
s.test_files = Dir["test/**/*"]
s.add_dependency "rufus-scheduler", "~> 3.6.0"
end

View File

@ -0,0 +1,9 @@
require 'rufus-scheduler'
scheduler = Rufus::Scheduler.new
#return if defined?(Rails::Console) || Rails.env.test? || File.split($0).last == 'rake'
scheduler.cron '43 2 * * *' do
system('bundle exec rake bulletin:remove_preview_bulletins')
end