Class: Asyncapi::Server::JobStatusNotifierWorker

Inherits:
Object
  • Object
show all
Includes:
Sidekiq::Worker
Defined in:
app/workers/asyncapi/server/job_status_notifier_worker.rb

Constant Summary collapse

MAX_RETRIES =
2

Instance Method Summary collapse

Instance Method Details

#perform(job_id, job_message, retries = 0) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/workers/asyncapi/server/job_status_notifier_worker.rb', line 8

def perform(job_id, job_message, retries=0)
  @job = Job.find(job_id)

  report_job_status(job_message)

  unless @response.code == 200
    if retries <= MAX_RETRIES
      @jid = JobStatusNotifierWorker.perform_async(job_id, job_message, retries+1)
    else
      raise format_error("Something went wrong while poking #{@job.callback_url}")
    end
  end
end