From 73b7dc6473ab30ef7ea45b3537665757247ae2b7 Mon Sep 17 00:00:00 2001 From: Mitchell Henke Date: Tue, 19 Oct 2021 09:08:50 -0500 Subject: [PATCH 1/4] schedule GPO cron job to run before 6AM Eastern time in both DST and Standard --- config/initializers/job_configurations.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config/initializers/job_configurations.rb b/config/initializers/job_configurations.rb index cd608de9b38..d746a841258 100644 --- a/config/initializers/job_configurations.rb +++ b/config/initializers/job_configurations.rb @@ -6,6 +6,7 @@ cron_1h = '0 * * * *' interval_1h = 60 * 60 cron_24h = '0 0 * * *' +gpo_cron_24h = '0 10 * * *' inteval_24h = 24 * 60 * 60 # Once we enable ruby workers in prod, we can remove all the JobRunner code and config @@ -21,7 +22,7 @@ }, good_job: { class: 'GpoDailyJob', - cron: cron_24h, + cron: gpo_cron_24h, args: -> { [Time.zone.today] }, }, }, From a6eefd44716efd606028c00ac1d46cfe92766603 Mon Sep 17 00:00:00 2001 From: Mitchell Henke Date: Tue, 19 Oct 2021 09:16:32 -0500 Subject: [PATCH 2/4] more specific file name --- app/services/gpo_confirmation_uploader.rb | 2 +- spec/services/gpo_confirmation_uploader_spec.rb | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/services/gpo_confirmation_uploader.rb b/app/services/gpo_confirmation_uploader.rb index 91133fe0897..480cdb1d9da 100644 --- a/app/services/gpo_confirmation_uploader.rb +++ b/app/services/gpo_confirmation_uploader.rb @@ -32,7 +32,7 @@ def clear_confirmations(confirmations) end def remote_path - timestamp = @now.strftime('%Y%m%d') + timestamp = @now.strftime('%Y%m%d-%H%M%S') File.join(IdentityConfig.store.usps_upload_sftp_directory, "batch#{timestamp}.psv") end diff --git a/spec/services/gpo_confirmation_uploader_spec.rb b/spec/services/gpo_confirmation_uploader_spec.rb index 1449798c3bc..f4b45e0815a 100644 --- a/spec/services/gpo_confirmation_uploader_spec.rb +++ b/spec/services/gpo_confirmation_uploader_spec.rb @@ -98,7 +98,7 @@ expect(NewRelic::Agent).to receive(:notice_error) - expect { subject }.to_not raise_error + expect { subject }.to raise_error expect(GpoConfirmation.count).to eq 1 end @@ -115,7 +115,7 @@ def sftp_options end def upload_folder - timestamp = Time.zone.now.strftime('%Y%m%d') + timestamp = Time.zone.now.strftime('%Y%m%d-%H%M%S') File.join(IdentityConfig.store.usps_upload_sftp_directory, "batch#{timestamp}.psv") end From 934818e1f2cfa21bd6f585e992ece3ee992580ff Mon Sep 17 00:00:00 2001 From: Mitchell Henke Date: Tue, 19 Oct 2021 09:26:16 -0500 Subject: [PATCH 3/4] raise error after sending error to new relic --- app/services/gpo_confirmation_uploader.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/services/gpo_confirmation_uploader.rb b/app/services/gpo_confirmation_uploader.rb index 480cdb1d9da..23fb6f37ae2 100644 --- a/app/services/gpo_confirmation_uploader.rb +++ b/app/services/gpo_confirmation_uploader.rb @@ -11,6 +11,7 @@ def run clear_confirmations(confirmations) rescue StandardError => error NewRelic::Agent.notice_error(error) + raise error end private From b8be8c2935032da82efdc4a71e064a9d7416f575 Mon Sep 17 00:00:00 2001 From: Mitchell Henke Date: Tue, 19 Oct 2021 11:09:40 -0500 Subject: [PATCH 4/4] Update config/initializers/job_configurations.rb Co-authored-by: Zach Margolis --- config/initializers/job_configurations.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/initializers/job_configurations.rb b/config/initializers/job_configurations.rb index d746a841258..d60bcc2cc31 100644 --- a/config/initializers/job_configurations.rb +++ b/config/initializers/job_configurations.rb @@ -6,7 +6,7 @@ cron_1h = '0 * * * *' interval_1h = 60 * 60 cron_24h = '0 0 * * *' -gpo_cron_24h = '0 10 * * *' +gpo_cron_24h = '0 10 * * *' # 10am UTC is 5am EST/6am EDT inteval_24h = 24 * 60 * 60 # Once we enable ruby workers in prod, we can remove all the JobRunner code and config