From 100081b24962c873bf09a89015a9e294c2c0da49 Mon Sep 17 00:00:00 2001 From: Cory McDonald Date: Mon, 5 Aug 2019 11:27:01 -0500 Subject: [PATCH] Remove useless slack message and skip (#2097) * Remove slack message * Don't queue up things that won't succeed --- app/jobs/create_uphold_cards_job.rb | 1 - app/jobs/migrate_uphold_access_parameters_job.rb | 5 ++++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/jobs/create_uphold_cards_job.rb b/app/jobs/create_uphold_cards_job.rb index 8c5ea18030..2c3945c285 100644 --- a/app/jobs/create_uphold_cards_job.rb +++ b/app/jobs/create_uphold_cards_job.rb @@ -6,7 +6,6 @@ def perform(uphold_connection_id:) uphold_connection = UpholdConnection.find(uphold_connection_id) unless uphold_connection.can_create_uphold_cards? Rails.logger.info("Could not create uphold card for publisher #{uphold_connection.publisher_id}. Uphold Verified: #{uphold_connection.uphold_verified}") - SlackMessenger.new(message: "Could not create uphold card for publisher #{uphold_connection.publisher_id}.", channel: SlackMessenger::ALERTS).perform return end diff --git a/app/jobs/migrate_uphold_access_parameters_job.rb b/app/jobs/migrate_uphold_access_parameters_job.rb index 541f0d73a7..b20b894f9e 100644 --- a/app/jobs/migrate_uphold_access_parameters_job.rb +++ b/app/jobs/migrate_uphold_access_parameters_job.rb @@ -12,7 +12,10 @@ def perform(publisher_id:, parameters:, default_currency:) default_currency_confirmed_at: connection.publisher.default_currency_confirmed_at || Time.now ) - connection.sync_from_uphold! + was_successful = connection.sync_from_uphold! + # Let's not queue up a job that will ultimately not work due to invalid access_parameters + next unless was_successful + connection.reload # Sync the uphold card or create it if the card is missing