mirror of
https://github.com/we-promise/sure.git
synced 2026-04-13 17:14:05 +00:00
* Add scheduled job to sync all accounts every 30 minutes Signed-off-by: Nikhil Badyal <nikhill773384@gmail.com> * Change job queue from default to scheduled Signed-off-by: Juan José Mata <juanjo.mata@gmail.com> * Flatten job into single directory * Every 30 minutes is a bit much and will trigger Sentry warnings * Locking and logging improvements * Add support for extra Sidekiq goodies --------- Signed-off-by: Nikhil Badyal <nikhill773384@gmail.com> Signed-off-by: Juan José Mata <juanjo.mata@gmail.com> Co-authored-by: Nikhil Badyal <nikhill773384@gmail.com>
15 lines
411 B
Ruby
15 lines
411 B
Ruby
class SyncAllJob < ApplicationJob
|
|
queue_as :scheduled
|
|
sidekiq_options lock: :until_executed, on_conflict: :log
|
|
|
|
def perform
|
|
Rails.logger.info("Starting sync for all families")
|
|
Family.find_each do |family|
|
|
family.sync_later
|
|
rescue => e
|
|
Rails.logger.error("Failed to sync family #{family.id}: #{e.message}")
|
|
end
|
|
Rails.logger.info("Completed sync for all families")
|
|
end
|
|
end
|