Class: GeoblacklightAdmin::DeleteThumbnailJob
- Inherits:
-
ApplicationJob
- Object
- ApplicationJob
- GeoblacklightAdmin::DeleteThumbnailJob
- Defined in:
- app/jobs/geoblacklight_admin/delete_thumbnail_job.rb
Overview
A job to delete the thumbnail associated with a Solr document.
This job is enqueued with a priority queue and can optionally handle a bad document ID to transition its state.
Instance Method Summary collapse
-
#perform(solr_document_id, bad_id = nil, queue = :priority) ⇒ Object
Performs the job to delete a thumbnail.
Instance Method Details
#perform(solr_document_id, bad_id = nil, queue = :priority) ⇒ Object
Performs the job to delete a thumbnail.
If the document has a thumbnail, it will be destroyed. If a bad_id is provided, it will transition the state of the BulkActionDocument to :success.
28 29 30 31 32 33 34 |
# File 'app/jobs/geoblacklight_admin/delete_thumbnail_job.rb', line 28 def perform(solr_document_id, bad_id = nil, queue = :priority) document = Document.find_by_friendlier_id(solr_document_id) if document.thumbnail.present? document.thumbnail.destroy! end BulkActionDocument.find(bad_id).state_machine.transition_to!(:success) if bad_id.present? end |