Skip to content

Commit

Permalink
Don't run the file characterization job for derivatives.
Browse files Browse the repository at this point in the history
  • Loading branch information
lsitu committed Aug 28, 2023
1 parent ec806fc commit c42d0f8
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions app/services/hyrax/listeners/file_metadata_listener.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,8 @@ def on_file_characterized(event)
CreateDerivativesJob
.perform_later(file_set, event[:file_id], event[:path_hint])
else
# With valkyrie, file.characterized event is also published for derivatives.
# We only need to create derivative for the original file.
file_id = event[:file_id]
file_metadata = Hyrax.custom_queries.find_file_metadata_by(id: file_id)

ValkyrieCreateDerivativesJob.perform_later(file_set.id.to_s, file_id) if file_metadata&.original_file?
ValkyrieCreateDerivativesJob
.perform_later(file_set.id.to_s, event[:file_id])
end
end

Expand All @@ -51,7 +47,9 @@ def on_file_metadata_updated(event)
# @param [Dry::Events::Event] event
# @return [void]
def on_file_uploaded(event)
# Run characterization
# Run characterization for original file only
return unless event[:metadata].original_file?

Hyrax.config
.characterization_service
.run(metadata: event[:metadata], file: event[:metadata].file)
Expand Down

0 comments on commit c42d0f8

Please sign in to comment.