mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-04-02 06:51:40 +00:00
Move database clean from cron to Sidekiq scheduler
After moving the remaining tasks from schedule.rb to sidekiq.yml, we can remove whenever and won't rely on cron any more. That will simplify the setup and migration to a new server.
This commit is contained in:
13
app/jobs/rake_job.rb
Normal file
13
app/jobs/rake_job.rb
Normal file
@@ -0,0 +1,13 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Executes a rake task
|
||||
class RakeJob < ApplicationJob
|
||||
def perform(task_string)
|
||||
Rails.application.load_tasks if Rake::Task.tasks.empty?
|
||||
|
||||
Rake.application.invoke_task(task_string)
|
||||
ensure
|
||||
name, _args = Rake.application.parse_task_string(task_string)
|
||||
Rake::Task[name].reenable
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user