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

class ReblogStatusWorker
  include Sidekiq::Worker

  sidekiq_options unique: :until_executed

  def perform(account_id, status_id, reblog_params = {})
    account = Account.find(account_id)
    status = Status.find(status_id)
    return false if status.destroyed?
    ReblogService.new.call(account, status, reblog_params.symbolize_keys)
    true
  rescue ActiveRecord::RecordNotFound, ActiveRecord::RecordInvalid
    true
  end
end