about summary refs log tree commit diff
path: root/app/workers/maintenance/uncache_preview_worker.rb
blob: 810ffd8ccf260c0a0aaaaea07b9f65937d64652e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# frozen_string_literal: true

class Maintenance::UncachePreviewWorker
  include Sidekiq::Worker

  sidekiq_options queue: 'pull'

  def perform(preview_card_id)
    preview_card = PreviewCard.find(preview_card_id)

    return if preview_card.image.blank?

    preview_card.image.destroy
    preview_card.save
  rescue ActiveRecord::RecordNotFound
    true
  end
end