Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Job Cancellation Code from VBADocuments::UploadProcessor #16087

Merged
merged 2 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Loading