Class: CreateDerivativesJob

Inherits:
ActiveJob::Base
  • Object
show all
Defined in:
app/jobs/create_derivatives_job.rb

Instance Method Summary collapse

Instance Method Details

#parent_needs_reindex?(file_set) ⇒ Boolean

If this file_set is the thumbnail for the parent work, then the parent also needs to be reindexed.

Returns:

  • (Boolean)


17
18
19
20
# File 'app/jobs/create_derivatives_job.rb', line 17

def parent_needs_reindex?(file_set)
  return false unless file_set.parent
  file_set.parent.thumbnail_id == file_set.id
end

#perform(file_set, file_name) ⇒ Object

Parameters:

  • file_set (FileSet)
  • file_name (String)


6
7
8
9
10
11
12
13
# File 'app/jobs/create_derivatives_job.rb', line 6

def perform(file_set, file_name)
  return if file_set.video? && !CurationConcerns.config.enable_ffmpeg

  file_set.create_derivatives(file_name)
  # The thumbnail is indexed in the solr document, so reindex
  file_set.update_index
  file_set.parent.update_index if parent_needs_reindex?(file_set)
end