2017-08-12 08:32:15 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-10-22 13:16:59 -04:00
|
|
|
# Provides asynchronous purging of ActiveStorage::Blob records via ActiveStorage::Blob#purge_later.
|
2017-11-03 11:29:21 -04:00
|
|
|
class ActiveStorage::PurgeJob < ActiveStorage::BaseJob
|
2019-01-01 19:40:59 -05:00
|
|
|
queue_as { ActiveStorage.queues[:purge] }
|
|
|
|
|
2018-07-26 09:24:31 -04:00
|
|
|
discard_on ActiveRecord::RecordNotFound
|
2018-07-31 19:29:23 -04:00
|
|
|
retry_on ActiveRecord::Deadlocked, attempts: 10, wait: :exponentially_longer
|
2018-07-11 22:09:23 -04:00
|
|
|
|
2017-08-29 00:02:59 -04:00
|
|
|
def perform(blob)
|
|
|
|
blob.purge
|
2017-07-05 07:06:29 -04:00
|
|
|
end
|
|
|
|
end
|