Skip to content

Commit

Permalink
Changing derivatives job to perform_now
Browse files Browse the repository at this point in the history
This allows for characterization and derivatives generation to be performed in the same context,
which is safer if a file is being passed in.
  • Loading branch information
carolyncole committed Nov 23, 2016
1 parent 90eb6a7 commit d14d4d7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/jobs/characterize_job.rb
Expand Up @@ -12,6 +12,6 @@ def perform(file_set, file_id, filepath = nil)
file_set.characterization_proxy.save!
file_set.update_index
file_set.parent.in_collections.each(&:update_index) if file_set.parent
CreateDerivativesJob.perform_later(file_set, file_id, filename)
CreateDerivativesJob.perform_now(file_set, file_id, filename)
end
end
4 changes: 2 additions & 2 deletions spec/jobs/characterize_job_spec.rb
Expand Up @@ -25,7 +25,7 @@
expect(Hydra::Works::CharacterizationService).to receive(:run).with(file, filename)
expect(file).to receive(:save!)
expect(file_set).to receive(:update_index)
expect(CreateDerivativesJob).to receive(:perform_later).with(file_set, file.id, filename)
expect(CreateDerivativesJob).to receive(:perform_now).with(file_set, file.id, filename)
described_class.perform_now(file_set, file.id)
end
end
Expand All @@ -46,7 +46,7 @@
allow(Hydra::Works::CharacterizationService).to receive(:run).with(file, filename)
allow(file).to receive(:save!)
allow(file_set).to receive(:update_index)
allow(CreateDerivativesJob).to receive(:perform_later).with(file_set, file.id, filename)
allow(CreateDerivativesJob).to receive(:perform_now).with(file_set, file.id, filename)
end
it "reindexes the collection" do
expect(collection).to receive(:update_index)
Expand Down

0 comments on commit d14d4d7

Please sign in to comment.