1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-08-03 04:25:21 +02:00

Handle duplicate sync jobs

This commit is contained in:
Zach Gollwitzer 2025-05-24 17:58:17 -04:00
parent aecb5aafd8
commit 5125411822
2 changed files with 17 additions and 0 deletions

View file

@ -57,6 +57,12 @@ class Sync < ApplicationRecord
def perform
Rails.logger.tagged("Sync", id, syncable_type, syncable_id) do
# This can happen on server restarts or if Sidekiq enqueues a duplicate job
unless may_start?
Rails.logger.warn("Sync #{id} is not in a valid state (#{aasm.from_state}) to start. Skipping sync.")
return
end
start!
begin