From 7f0a6ce7b79fd1f6a0797a7514d5a364aef2bbda Mon Sep 17 00:00:00 2001 From: Kristen Brown <11942904+kristen-brown@users.noreply.github.com> Date: Tue, 26 Mar 2024 11:10:01 -0400 Subject: [PATCH] Remove Job Cancellation Code from `VBADocuments::UploadProcessor` (#16087) * Remove job cancellation code which we believe is causing submissions to not be processed * Remove references to UploadProcessor cancel method --- .../sidekiq/vba_documents/upload_processor.rb | 16 ---------------- .../spec/request/v1/uploads_request_spec.rb | 1 - .../spec/request/v2/uploads_request_spec.rb | 1 - .../spec/sidekiq/upload_processor_spec.rb | 1 - 4 files changed, 19 deletions(-) diff --git a/modules/vba_documents/app/sidekiq/vba_documents/upload_processor.rb b/modules/vba_documents/app/sidekiq/vba_documents/upload_processor.rb index 43a35c36ffb..6909fec42f0 100644 --- a/modules/vba_documents/app/sidekiq/vba_documents/upload_processor.rb +++ b/modules/vba_documents/app/sidekiq/vba_documents/upload_processor.rb @@ -21,8 +21,6 @@ class UploadProcessor sidekiq_options unique_for: 30.days def perform(guid, caller_data, retries = 0) - return if cancelled? - response = nil brt = Benchmark.realtime do # @retries variable used via the CentralMail::Utilities which is included via VBADocuments::UploadValidations @@ -46,20 +44,6 @@ def perform(guid, caller_data, retries = 0) response&.success? ? true : false end - def cancelled? - Sidekiq.redis do |c| - if c.respond_to? :exists? - c.exists?("cancelled-#{jid}") - else - c.exists("cancelled-#{jid}") - end - end - end - - def self.cancel!(jid) - Sidekiq.redis { |c| c.setex("cancelled-#{jid}", 86_400, 1) } - end - private # rubocop:disable Metrics/MethodLength diff --git a/modules/vba_documents/spec/request/v1/uploads_request_spec.rb b/modules/vba_documents/spec/request/v1/uploads_request_spec.rb index aec54da50f3..7553ff67406 100644 --- a/modules/vba_documents/spec/request/v1/uploads_request_spec.rb +++ b/modules/vba_documents/spec/request/v1/uploads_request_spec.rb @@ -135,7 +135,6 @@ @md = JSON.parse(valid_metadata) @upload_submission = VBADocuments::UploadSubmission.new @upload_submission.update(status: 'uploaded') - allow_any_instance_of(VBADocuments::UploadProcessor).to receive(:cancelled?).and_return(false) allow_any_instance_of(Tempfile).to receive(:size).and_return(1) # must be > 0 or submission will error w/DOC107 allow(VBADocuments::MultipartParser).to receive(:parse) { { 'metadata' => @md.to_json, 'content' => valid_doc } diff --git a/modules/vba_documents/spec/request/v2/uploads_request_spec.rb b/modules/vba_documents/spec/request/v2/uploads_request_spec.rb index 4a4e2646cb9..5d74d97bdbd 100644 --- a/modules/vba_documents/spec/request/v2/uploads_request_spec.rb +++ b/modules/vba_documents/spec/request/v2/uploads_request_spec.rb @@ -202,7 +202,6 @@ @md = JSON.parse(valid_metadata) @upload_submission = VBADocuments::UploadSubmission.new @upload_submission.update(status: 'uploaded') - allow_any_instance_of(VBADocuments::UploadProcessor).to receive(:cancelled?).and_return(false) allow_any_instance_of(Tempfile).to receive(:size).and_return(1) # must be > 0 or submission will error w/DOC107 allow(VBADocuments::MultipartParser).to receive(:parse) { { 'metadata' => @md.to_json, 'content' => valid_doc } diff --git a/modules/vba_documents/spec/sidekiq/upload_processor_spec.rb b/modules/vba_documents/spec/sidekiq/upload_processor_spec.rb index c032d7aa89c..5c6294272eb 100644 --- a/modules/vba_documents/spec/sidekiq/upload_processor_spec.rb +++ b/modules/vba_documents/spec/sidekiq/upload_processor_spec.rb @@ -72,7 +72,6 @@ end before do - allow_any_instance_of(described_class).to receive(:cancelled?).and_return(false) allow_any_instance_of(Tempfile).to receive(:size).and_return(1) # must be > 0 or submission will error w/DOC107 objstore = instance_double(VBADocuments::ObjectStore) version = instance_double(Aws::S3::ObjectVersion)