Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Backoff Strategies

config { Worker.backoffStrategy = exponentialBackoff 2.0 3600 }  -- base^attempts, cap 1h
config { Worker.backoffStrategy = linearBackoff 30 600 }         -- +30s/attempt, cap 10m
config { Worker.backoffStrategy = constantBackoff 60 }           -- always 60s
config { Worker.backoffStrategy = Custom (\n -> fromIntegral n * 15) }

config { Worker.jitter = FullJitter }   -- random(0, delay)
config { Worker.jitter = EqualJitter }  -- delay/2 + random(0, delay/2) (default)
config { Worker.jitter = NoJitter }

The claim operation increments the attempt count before the handler starts. Arbiter calculates the delay from the new count. The first failure is attempt

  1. Therefore, exponentialBackoff 2.0 gives a two-second delay before the first retry.

Jitter changes the calculated delay. The default EqualJitter selects a value between one half and all of the calculated delay. The strategy value is the maximum delay.

A nack does not use the backoff strategy. The job remains unavailable for the rest of its lease. Set the job visibility timeout before the nack to control this period. See Error Handling.

See the Arbiter.Worker.BackoffStrategy haddocks for every strategy and jitter mode.