about summary refs log blame commit diff
path: root/app/workers/fetch_avatar_worker.rb
blob: c5d05492ed1b25878cee9be41350e721cac0da0c (plain) (tree)
1
2
3
                             
                       











                                                                  
# frozen_string_literal: true

class FetchAvatarWorker
  include Sidekiq::Worker

  sidekiq_options queue: 'bulk', retry: 2

  def perform(account_id)
    account = Account.find(account_id)
    return if account.suspended_at?
    account.reset_avatar! unless account.avatar_remote_url.nil?
    account.reset_header! unless account.header_remote_url.nil?
  rescue ActiveRecord::RecordNotFound, ActiveRecord::RecordInvalid
    true
  end
end