9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'app/jobs/geoblacklight_admin/store_image_job.rb', line 9
def perform(solr_document_id, bad_id = nil, queue = :default)
document = Document.find_by_friendlier_id(solr_document_id)
if document&.thumbnail&.present?
document.thumbnail.destroy!
end
metadata = {}
metadata["solr_doc_id"] = solr_document_id
document.thumbnail_state_machine.transition_to!(:queued, metadata)
sleep(rand(1..5))
GeoblacklightAdmin::ImageService.new(document).store
BulkActionDocument.find(bad_id).state_machine.transition_to!(:success) if bad_id.present?
end
|