diff --git a/Procfile b/Procfile index e7f4ebb6..508a93c6 100644 --- a/Procfile +++ b/Procfile @@ -1,3 +1,3 @@ cleanup: bundle exec rake cleanup:everything stats: bundle exec rake stats:process_all -emergency_cleanup: bundle exec rake cleanup:everything[7] +emergency_cleanup: bundle exec rake cleanup:everything BEFORE=7 diff --git a/lib/tasks/cleanup.rake b/lib/tasks/cleanup.rake index 6ea48c0d..20044871 100644 --- a/lib/tasks/cleanup.rake +++ b/lib/tasks/cleanup.rake @@ -3,6 +3,8 @@ namespace :cleanup do desc 'Cleanup sites' task everything: :environment do |_, args| - CleanupJob.perform_later((args.extras.first || 30).to_i.days.ago) + before = ENV.fetch('BEFORE', '30').to_i.days.ago + + CleanupJob.perform_later(before) end end