Class: Upgrade::FixNilFileSizeValues

Inherits:
IterationJob
  • Object
show all
Defined in:
app/jobs/upgrade/fix_nil_file_size_values.rb

Instance Method Summary collapse

Instance Method Details

#build_enumerator(cursor:) ⇒ Object



4
5
6
# File 'app/jobs/upgrade/fix_nil_file_size_values.rb', line 4

def build_enumerator(cursor:)
  enumerator_builder.active_record_on_records(ModelFile.unscoped.where(size: nil), cursor: cursor)
end

#each_iteration(modelfile) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'app/jobs/upgrade/fix_nil_file_size_values.rb', line 8

def each_iteration(modelfile)
  modelfile.refresh_metadata!
rescue Errno::EACCES => ex
  Rails.logger.error ex.message
rescue Shrine::FileNotFound
  Rails.logger.error("File not found: #{modelfile.path_within_library}")
rescue Shrine::Error => ex
  Rails.logger.error("File error: #{ex.message} #{modelfile.path_within_library}")
end