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.4.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


36
37
38
# File 'lib/sidekiq_iteration.rb', line 36

def default_retry_backoff
  @default_retry_backoff
end

.loggerObject



46
47
48
# File 'lib/sidekiq_iteration.rb', line 46

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


25
26
27
# File 'lib/sidekiq_iteration.rb', line 25

def max_job_runtime
  @max_job_runtime
end

.stoppingObject



51
52
53
# File 'lib/sidekiq_iteration.rb', line 51

def stopping
  @stopping
end