fix: Move rule application to perform_post_sync method (#705)

* Move rule application to perform_post_sync method

Signed-off-by: Alessio Cappa <104093777+alessiocappa@users.noreply.github.com>

* fix: Update test

---------

Signed-off-by: Alessio Cappa <104093777+alessiocappa@users.noreply.github.com>
This commit is contained in:
Alessio Cappa
2026-01-19 22:57:46 +01:00
committed by GitHub
parent 8b8ac705f6
commit 2e081ea82d
2 changed files with 6 additions and 5 deletions

View File

@@ -9,11 +9,6 @@ class Family::Syncer
# We don't rely on this value to guard the app, but keep it eventually consistent
family.sync_trial_status!
Rails.logger.info("Applying rules for family #{family.id}")
family.rules.where(active: true).each do |rule|
rule.apply_later
end
# Schedule child syncs
child_syncables.each do |syncable|
syncable.sync_later(parent_sync: sync, window_start_date: sync.window_start_date, window_end_date: sync.window_end_date)
@@ -22,6 +17,11 @@ class Family::Syncer
def perform_post_sync
family.auto_match_transfers!
Rails.logger.info("Applying rules for family #{family.id}")
family.rules.where(active: true).each do |rule|
rule.apply_later
end
end
private

View File

@@ -62,5 +62,6 @@ class Family::SyncerTest < ActiveSupport::TestCase
EnableBankingItem.any_instance.stubs(:sync_later)
syncer.perform_sync(family_sync)
syncer.perform_post_sync
end
end