mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-08-02 20:15:22 +02:00
Transactional locks for sync completions (#2219)
* Transactional locks for sync completions * Lower sync display logic tolerance in UI
This commit is contained in:
parent
71be2a04ad
commit
a07e9d40a3
2 changed files with 9 additions and 11 deletions
|
@ -96,15 +96,15 @@ class Family < ApplicationRecord
|
|||
broadcast_refresh
|
||||
end
|
||||
|
||||
# If family has any syncs pending/syncing within the last hour, we show a persistent "syncing" notice.
|
||||
# Ignore syncs older than 1 hour as they are considered "stale"
|
||||
# If family has any syncs pending/syncing within the last 10 minutes, we show a persistent "syncing" notice.
|
||||
# Ignore syncs older than 10 minutes as they are considered "stale"
|
||||
def syncing?
|
||||
Sync.where(
|
||||
"(syncable_type = 'Family' AND syncable_id = ?) OR
|
||||
(syncable_type = 'Account' AND syncable_id IN (SELECT id FROM accounts WHERE family_id = ? AND plaid_account_id IS NULL)) OR
|
||||
(syncable_type = 'PlaidItem' AND syncable_id IN (SELECT id FROM plaid_items WHERE family_id = ?))",
|
||||
id, id, id
|
||||
).where(status: [ "pending", "syncing" ], created_at: 1.hour.ago..).exists?
|
||||
).where(status: [ "pending", "syncing" ], created_at: 10.minutes.ago..).exists?
|
||||
end
|
||||
|
||||
def eu?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue