Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Remove retry as diskfile is already accessible

Oliver Günther2fcfa3ed3f79
diff --git a/modules/bim/app/models/bim/ifc_models/ifc_model.rb b/modules/bim/app/models/bim/ifc_models/ifc_model.rb
index 1c39223297d..801cf04de62 100644
--- a/modules/bim/app/models/bim/ifc_models/ifc_model.rb
+++ b/modules/bim/app/models/bim/ifc_models/ifc_model.rb
@@ -38,13 +38,6 @@ module Bim
xkt_attachment.present?
end
- ##
- # Test if the ifc attachment is readable.
- # Note that it has to access the diskfile and potentially download from storage for that(!)
- def ifc_attachment_ready?
- !ifc_attachment.prepared? && ifc_attachment.diskfile.present?
- end
-
private
##
diff --git a/modules/bim/app/workers/bim/ifc_models/ifc_conversion_job.rb b/modules/bim/app/workers/bim/ifc_models/ifc_conversion_job.rb
index dfacd81f19d..1366f79242e 100644
--- a/modules/bim/app/workers/bim/ifc_models/ifc_conversion_job.rb
+++ b/modules/bim/app/workers/bim/ifc_models/ifc_conversion_job.rb
@@ -6,8 +6,6 @@ module Bim
##
# Run the conversion of IFC to
def perform(ifc_model)
- return retry_job(wait: 1.minute) if attachment_missing?(ifc_model)
-
User.system.run_given do
result = ViewConverterService.new(ifc_model).call
@@ -17,14 +15,6 @@ module Bim
end
end
end
-
- private
-
- ##
- # Is the ifc attachment of the model ready for consumption?
- def attachment_missing?(ifc_model)
- !ifc_model.ifc_attachment_ready?
- end
end
end
end
diff --git a/modules/bim/spec/workers/ifc_conversion_job_spec.rb b/modules/bim/spec/workers/ifc_conversion_job_spec.rb
index 460d81c6627..547842ac190 100644
--- a/modules/bim/spec/workers/ifc_conversion_job_spec.rb
+++ b/modules/bim/spec/workers/ifc_conversion_job_spec.rb
@@ -2,46 +2,13 @@ require 'spec_helper'
describe Bim::IfcModels::IfcConversionJob, type: :job do
let(:model) { FactoryBot.build :ifc_model }
- let(:instance) { described_class.new }
- let(:attachment_double) { instance_double(Attachment) }
- let(:prepared) { false }
- let(:diskfile) { 'foo' }
-
- subject { instance.perform(model) }
-
- before do
- allow(model).to receive(:ifc_attachment).and_return(attachment_double)
- allow(attachment_double).to receive(:diskfile).and_return diskfile
- allow(attachment_double).to receive(:prepared?).and_return prepared
- end
+ subject { described_class.perform_now(model) }
it 'calls the conversion service' do
expect(::Bim::IfcModels::ViewConverterService)
.to receive_message_chain(:new, :call)
- .and_return ServiceResult.new success: true
+ .and_return ServiceResult.new success: true
expect { subject }.not_to raise_error
end
-
- shared_examples 'will reschedule' do
- it 'will reschedule the job' do
- allow(instance).to receive(:retry_job)
-
- subject
-
- expect(instance).to have_received(:retry_job).with(wait: 1.minute)
- end
- end
-
- context 'when the diskfile is empty' do
- let(:diskfile) { nil }
-
- it_behaves_like 'will reschedule'
- end
-
- context 'when the attachment is not persisted' do
- let(:prepared) { true }
-
- it_behaves_like 'will reschedule'
- end
end