Class: Workers::TicketTransactions::RestoreQuotaWorker

Inherits:
ApplicationWorker show all
Defined in:
app/workers/workers/ticket_transactions/restore_quota_worker.rb

Instance Method Summary collapse

Methods inherited from ApplicationWorker

unlimited_retry

Instance Method Details

#perform(ticket_group_id, tickets_to_restore) ⇒ Object

Parameters:

  • ticket_group_id (Integer)
  • tickets_to_restore (Array<String>)


7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/workers/workers/ticket_transactions/restore_quota_worker.rb', line 7

def perform(ticket_group_id, tickets_to_restore)
  quota_witness = InvQuotaWitness.new
  max_attempts = 5
  attempts = 0
  while attempts < max_attempts do
     if quota_witness.restore_quota(ticket_group_id, tickets_to_restore)
       break
     end
    attempts += 1
  end
  raise "retry again in sidekiq" if attempts == max_attempts
end