Optional
exponential?: null | { Optional
periodic?: null | { An exponential backoff retry function. Pass a job, a logger and an optional jobId to this function and it will
retry failed jobs with exponential backoff. On success, the promise resolves with true
. On failure, it throws
a RetryTimeoutError. See retry for more detailed information.
An exponential backoff retry function. Pass a job, a logger and an optional jobId to this function and it will
retry failed jobs with exponential backoff. On success, the promise resolves with true
. On failure, it throws
a RetryTimeoutError. See retry for more detailed information.
Optional
_jobId: stringA perioedic retry function. Pass a job, a logger and an optional jobId to this function and it will retry
failed jobs with periodic retries. On success, the promise resolves with true
. On failure, it throws a
RetryTimeoutError. See retry for more detailed information.
A perioedic retry function. Pass a job, a logger and an optional jobId to this function and it will retry
failed jobs with periodic retries. On success, the promise resolves with true
. On failure, it throws a
RetryTimeoutError. See retry for more detailed information.
Optional
_jobId: stringGenerated using TypeDoc
A Weenie function providing several options for job retry logic.
These retry functions are intended to be used to retry failed jobs using a certain algorithm (e.g., exponential backoff).
Available Config Options
config.retry.exponential.initialRetryMs
- This is the intitial time in ms that we should wait before retrying. once inside the retry loop, this quantity is doubled on each failed attempt, creating an exponential retry.config.retry.exponential.maxRetryMs
- Maximum time to wait in ms before the application should stop retrying and throw a RetryTimeoutError. Note that this is an absolute value which includes time spent actually running the job. For example, if you set this to 1 hour and your job takes 30 minutes to run, you will only get 2 retries.config.retry.periodic.initialWaitMs
- This is the time in ms that we should wait before our initial retry. Occasionally it is useful to have a longer or shorter initial wait time than for subsequent retries.config.retry.periodic.intervalMs
- This is the time in ms that we should wait between retries after the first retry.config.retry.periodic.maxRetryMs
- Maximum time to wait in ms before the application should stop retrying this job and throw a RetryTimeoutError. Note that this is an absolute value which includes time spent actually running the job. For example, if you set this to 1 hour and your job takes 30 minutes to run, you will only get 2 retries.Provided Dependencies
deps.retry.exponential
- A function that takes a job and a logger and runs the job with exponential backoff retry on failure.deps.retry.periodic
- A function that takes a job and a logger and runs the job with periodic retries on failure.NOTE: Jobs should return
true
on success andfalse
on failure. While returningfalse
is functionally equivalent to throwing an error, there is a subtle difference in meaning.false
indicates that the job maintained control of the process but could not complete its task. Throwing an error indicates that the job lost control of the process. Perhaps a difference without a distinction, but possibly useful in some cases.