Class: SidekiqBulkJob::JobRetry

Inherits:
Object
  • Object
show all
Defined in:
lib/sidekiq_bulk_job/job_retry.rb

Instance Method Summary collapse

Constructor Details

#initialize(klass, error_handle, options = {}) ⇒ JobRetry

Returns a new instance of JobRetry.



10
11
12
13
14
15
# File 'lib/sidekiq_bulk_job/job_retry.rb', line 10

def initialize(klass, error_handle, options={})
  @handler = Sidekiq::JobRetry.new(options)
  @klass = klass
  @error_handle = error_handle
  @retry_count = 0
end

Instance Method Details

#push(options = {}) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/sidekiq_bulk_job/job_retry.rb', line 17

def push(options={})
  @retry_count = SidekiqBulkJob.redis.incr @error_handle.jid
  opts = job_options(options)
  queue_as = queue(@klass) || :default
  begin
    @handler.local(SidekiqBulkJob::BulkJob, opts, queue_as) do
      raise @error_handle.raise_error
    end
  rescue Exception => e
  end
end