Module: SidekiqIteration

Defined in:
lib/sidekiq_iteration.rb,
lib/sidekiq_iteration/version.rb,
lib/sidekiq_iteration/iteration.rb,
lib/sidekiq_iteration/throttling.rb,
lib/sidekiq_iteration/enumerators.rb,
lib/sidekiq_iteration/csv_enumerator.rb,
lib/sidekiq_iteration/job_retry_patch.rb,
lib/sidekiq_iteration/nested_enumerator.rb,
lib/sidekiq_iteration/active_record_enumerator.rb

Defined Under Namespace

Modules: Enumerators, Iteration, JobRetryPatch, Throttling Classes: ActiveRecordEnumerator, CsvEnumerator, NestedEnumerator

Constant Summary collapse

VERSION =
"0.3.0"

Class Attribute Summary collapse

Class Attribute Details

.default_retry_backoffObject

Configures a delay duration to wait before resuming an interrupted job.

Defaults to nil which means interrupted jobs will be retried immediately. This value will be ignored when an interruption is raised by a throttle enumerator, where the throttle backoff value will take precedence over this setting.

Examples:

SidekiqIteration.default_retry_backoff = 10.seconds


34
35
36
# File 'lib/sidekiq_iteration.rb', line 34

def default_retry_backoff
  @default_retry_backoff
end

.loggerObject



44
45
46
# File 'lib/sidekiq_iteration.rb', line 44

def logger
  @logger ||= Sidekiq.logger
end

.max_job_runtimeObject

Use this to always interrupt the job after it’s been running for more than N seconds.

This setting will make it to always interrupt a job after it’s been iterating for 5 minutes. Defaults to nil which means that jobs will not be interrupted except on termination signal.

Examples:

Global setting

SidekiqIteration.max_job_runtime = 5.minutes

Per-job setting

class MyJob
  # ...
  self.max_job_runtime = 1.minute
  # ...
end


23
24
25
# File 'lib/sidekiq_iteration.rb', line 23

def max_job_runtime
  @max_job_runtime
end