mirror of
https://github.com/we-promise/sure.git
synced 2026-04-13 00:57:22 +00:00
Tweak exception logging, sync stale behavior
This commit is contained in:
@@ -11,17 +11,18 @@ module Syncable
|
||||
|
||||
def sync_later(parent_sync: nil, window_start_date: nil, window_end_date: nil)
|
||||
Sync.transaction do
|
||||
# Expire any previous in-flight syncs for this record that exceeded the
|
||||
# global staleness window.
|
||||
syncs.stale_candidates.find_each(&:mark_stale!)
|
||||
# Since we're scheduling a new sync, mark old syncs for this syncable as stale
|
||||
self.syncs.incomplete.find_each(&:mark_stale!)
|
||||
|
||||
new_sync = syncs.create!(
|
||||
new_sync = self.syncs.create!(
|
||||
parent: parent_sync,
|
||||
window_start_date: window_start_date,
|
||||
window_end_date: window_end_date
|
||||
)
|
||||
|
||||
SyncJob.perform_later(new_sync)
|
||||
|
||||
new_sync
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user