Class Delayed::Worker
In: lib/delayed/worker.rb
Parent: Object

Methods

Constants

DEFAULT_LOG_LEVEL = 'info'.freeze
DEFAULT_SLEEP_DELAY = 5
DEFAULT_MAX_ATTEMPTS = 25
DEFAULT_MAX_RUN_TIME = 4.hours
DEFAULT_DEFAULT_PRIORITY = 0
DEFAULT_DELAY_JOBS = true
DEFAULT_QUEUES = [].freeze
DEFAULT_QUEUE_ATTRIBUTES = HashWithIndifferentAccess.new.freeze
DEFAULT_READ_AHEAD = 5

Attributes

name  [W]  Sets the name of the worker. Setting the name to nil will reset the default worker name
name_prefix  [RW]  name_prefix is ignored if name is set directly

Public Class methods

rubocop:disable ClassVars

Public Instance methods

Every worker has a unique name which by default is the pid of the process. There are some advantages to overriding this with something which survives worker restarts: Workers can safely resume working on tasks which are locked by themselves. The worker will assume that it crashed before.

Reschedule the job in the future (when a job fails). Uses an exponential scale depending on the number of failed attempts.

Do num jobs and return stats on success/failure. Exit early if interrupted.

Protected Instance methods

Run the next job we can get an exclusive lock on. If no jobs are left we return nil

[Validate]