The personal finance app for everyone
Split family and Plaid item syncs into multiple jobs (#1799)
Zach Gollwitzerc9c5eb315a29
diff --git a/app/models/family.rb b/app/models/family.rbindex 683df55b..2145b062 100644--- a/app/models/family.rb+++ b/app/models/family.rb@@ -37,16 +37,12 @@ class Family < ApplicationRecordupdate!(last_synced_at: Time.current)accounts.manual.each do |account|- account.sync_data(start_date: start_date)+ account.sync_later(start_date: start_date)end- plaid_data = []-plaid_items.each do |plaid_item|- plaid_data << plaid_item.sync_data(start_date: start_date)+ plaid_item.sync_later(start_date: start_date)end-- plaid_dataenddef post_syncdiff --git a/app/models/plaid_item.rb b/app/models/plaid_item.rbindex 9ac1e002..db6683d4 100644--- a/app/models/plaid_item.rb+++ b/app/models/plaid_item.rb@@ -41,7 +41,7 @@ class PlaidItem < ApplicationRecordplaid_data = fetch_and_load_plaid_dataaccounts.each do |account|- account.sync_data(start_date: start_date)+ account.sync_later(start_date: start_date)endplaid_datadiff --git a/test/models/family_test.rb b/test/models/family_test.rbindex 33088c81..ca09a211 100644--- a/test/models/family_test.rb+++ b/test/models/family_test.rb@@ -16,11 +16,11 @@ class FamilyTest < ActiveSupport::TestCasemanual_accounts_count = @syncable.accounts.manual.countitems_count = @syncable.plaid_items.count- Account.any_instance.expects(:sync_data)+ Account.any_instance.expects(:sync_later).with(start_date: nil).times(manual_accounts_count)- PlaidItem.any_instance.expects(:sync_data)+ PlaidItem.any_instance.expects(:sync_later).with(start_date: nil).times(items_count)