1
0
Fork 0
mirror of https://github.com/maybe-finance/maybe.git synced 2025-08-08 15:05:22 +02:00

Changed perform_asnyc to perform sincen GoodJob does not use perform_async

This commit is contained in:
Claude Ayitey 2024-01-06 14:57:33 +00:00
parent dcb44cee65
commit 32ca1fa432
6 changed files with 25 additions and 25 deletions

View file

@ -103,11 +103,11 @@ class AccountsController < ApplicationController
# Save the account
if @account.save
GenerateBalanceJob.perform_async(@account.id)
GenerateBalanceJob.perform(@account.id)
GenerateMetricsJob.perform_in(15.seconds, current_family.id)
if @account.kind == 'property' and @account.subkind == 'real_estate'
SyncPropertyValuesJob.perform_async(@account.id)
SyncPropertyValuesJob.perform(@account.id)
end
# If the account saved, redirect to the accounts page
@ -130,7 +130,7 @@ class AccountsController < ApplicationController
# Find or create a new "Manual Bank" connection
@connection = Connection.find_or_create_by(user: current_user, family: current_family, name: "Manual", source: "manual")
@account = Account.new
render layout: 'simple'
end
@ -160,7 +160,7 @@ class AccountsController < ApplicationController
# Find or create a new "Manual Bank" connection
@connection = Connection.find_or_create_by(user: current_user, family: current_family, name: "Manual", source: "manual")
@account = Account.new
render layout: 'simple'
end

View file

@ -16,7 +16,7 @@ class Api::PlaidController < ApplicationController
item_id = exchange_token_response.item_id
item_get_request = Plaid::ItemGetRequest.new({ access_token: access_token})
item_response = $plaid_api_client.item_get(item_get_request)
item_response = $plaid_api_client.item_get(item_get_request)
aggregator_id = item_response.item.institution_id
consent_expiration = item_response.item.consent_expiration_time
@ -41,11 +41,11 @@ class Api::PlaidController < ApplicationController
)
user.save!
SyncPlaidItemAccountsJob.perform_async(item_id)
SyncPlaidItemAccountsJob.perform(item_id)
# SyncPlaidHoldingsJob.perform(item_id)
# SyncPlaidInvestmentTransactionsJob.perform(item_id)
# SyncPlaidHoldingsJob.perform_async(item_id)
# SyncPlaidInvestmentTransactionsJob.perform_async(item_id)
GenerateMetricsJob.perform_in(1.minute, user.family.id)
render json: {

View file

@ -10,7 +10,7 @@ class ConnectionsController < ApplicationController
@connection = current_family.connections.find(params[:id])
@connection.destroy
GenerateMetricsJob.perform_async(current_family.id)
GenerateMetricsJob.perform(current_family.id)
redirect_to connections_path
end

View file

@ -37,8 +37,8 @@ class ConversationsController < ApplicationController
reply.user = nil
reply.role = "assistant"
reply.save
AskQuestionJob.perform_async(@conversation.id, reply.id)
AskQuestionJob.perform(@conversation.id, reply.id)
#conversation.broadcast_append_to "conversation_area", partial: "conversations/message", locals: { message: reply }, target: "conversation_area_#{conversation.id}"

View file

@ -7,6 +7,6 @@ class Security < ApplicationRecord
after_create :sync_price_history
def sync_price_history
SyncSecurityHistoryJob.perform_async(self.id)
SyncSecurityHistoryJob.perform(self.id)
end
end

View file

@ -2,48 +2,48 @@ namespace :maintenance do
desc "Quick Update"
task :quick_update => :environment do
Connection.all.each do |connection|
SyncPlaidItemAccountsJob.perform_async(connection.item_id)
SyncPlaidHoldingsJob.perform_async(connection.item_id)
SyncPlaidInvestmentTransactionsJob.perform_async(connection.item_id)
SyncPlaidItemAccountsJob.perform(connection.item_id)
SyncPlaidHoldingsJob.perform(connection.item_id)
SyncPlaidInvestmentTransactionsJob.perform(connection.item_id)
GenerateMetricsJob.perform_in(1.minute, connection.family_id)
end
EnrichTransactionsJob.perform_async
EnrichTransactionsJob.perform
# Sync security prices that haven't been synced in the last 24 hours or are nil
Security.where("last_synced_at IS NULL OR last_synced_at < ?", 24.hours.ago).each do |security|
SyncSecurityHistoryJob.perform_async(security.id)
SyncSecurityHistoryJob.perform(security.id)
end
# Sync security real time prices that haven't been synced in the last 30 minutes or are nil
Security.where("real_time_price_updated_at IS NULL OR real_time_price_updated_at < ?", 30.minutes.ago).each do |security|
RealTimeSyncJob.perform_async(security.id)
RealTimeSyncJob.perform(security.id)
end
Account.all.each do |account|
GenerateBalanceJob.perform_async(account.id)
GenerateBalanceJob.perform(account.id)
end
Account.property.each do |account|
SyncPropertyValuesJob.perform_async(account.id)
SyncPropertyValuesJob.perform(account.id)
end
Family.all.each do |family|
GenerateCategoricalMetricsJob.perform_async(family.id)
GenerateCategoricalMetricsJob.perform(family.id)
end
end
desc "Institution Sync"
task :institution_sync => :environment do
SyncPlaidInstitutionsJob.perform_async
SyncPlaidInstitutionsJob.perform_now
end
desc "Security Details Sync"
task :security_details_sync => :environment do
# Get Security where logo is nil
Security.where(logo: nil).each do |security|
SyncSecurityDetailsJob.perform_async(security.id)
SyncSecurityDetailsJob.perform(security.id)
end
end
@ -65,4 +65,4 @@ namespace :maintenance do
end
end
end
end
end