diff --git a/app/workers/civicrm_sync_groups_worker.rb b/app/workers/civicrm_sync_groups_worker.rb new file mode 100644 index 0000000..8d77e21 --- /dev/null +++ b/app/workers/civicrm_sync_groups_worker.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +require "rake" + +Rails.application.load_tasks + +class CivicrmSyncGroupsWorker + include Sidekiq::Worker + + def perform(*_args) + Rake::Task["civicrm:sync:groups"].invoke + end +end diff --git a/config/schedule.yml b/config/schedule.yml index 8dab689..6b1ad1a 100644 --- a/config/schedule.yml +++ b/config/schedule.yml @@ -5,3 +5,7 @@ metrics_job: class: "MetricsGenerationWorker" queue: metrics +civicrm_job: + cron: "30 2 * * *" + class: "CivicrmSyncGroupsWorker" + queue: default