mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-05 13:35:21 +02:00
Handle stale syncs (#2257)
* Handle stale syncs * Use `visible` sync logic in sidebar groups
This commit is contained in:
parent
10f255a9a9
commit
9f13b5bb83
9 changed files with 79 additions and 7 deletions
|
@ -10,8 +10,19 @@ module Syncable
|
|||
end
|
||||
|
||||
def sync_later(parent_sync: nil, window_start_date: nil, window_end_date: nil)
|
||||
new_sync = syncs.create!(parent: parent_sync, window_start_date: window_start_date, window_end_date: window_end_date)
|
||||
SyncJob.perform_later(new_sync)
|
||||
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!)
|
||||
|
||||
new_sync = syncs.create!(
|
||||
parent: parent_sync,
|
||||
window_start_date: window_start_date,
|
||||
window_end_date: window_end_date
|
||||
)
|
||||
|
||||
SyncJob.perform_later(new_sync)
|
||||
end
|
||||
end
|
||||
|
||||
def perform_sync(sync)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue