From 8c9648ca43a57f075024d9422a8838ae4df20979 Mon Sep 17 00:00:00 2001 From: Ryan Raub Date: Fri, 17 May 2019 14:56:13 -0700 Subject: [PATCH] updating docs to more clearly state the retry interval config --- README.md | 9 ++++----- lib/task_bunny/job.ex | 4 ++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index b3f7ac1..99903f9 100644 --- a/README.md +++ b/README.md @@ -126,8 +126,6 @@ Existing messages in the queue will be lost so please be aware of this. % mix task_bunny.queue.reset ``` -You need to redefine a queue when you want to change the retry interval for a queue. - #### Umbrella app @@ -314,7 +312,7 @@ TaskBunny marks the job failed when: - `perform` times out. TaskBunny retries the job automatically if the job has failed. -By default, it retries 10 times for every 5 minutes. +By default, it retries after at least 5 minutes, up to 10 times. If you want to change it, you can override the value on a job module. @@ -330,8 +328,9 @@ defmodule FlakyJob do end ``` -In this example, it will retry 100 times for every 10 seconds. -You can also change the retry_interval by the number of failures. +In this example, it will retry after a delay of 10 seconds up to 100 times. +You can also change the retry_interval by the number of failures, however the actual wait times may be longer +due to how RabbitMQ only expires messages from the front of the retry queue. ```elixir def max_retry, do: 5 diff --git a/lib/task_bunny/job.ex b/lib/task_bunny/job.ex index bed5868..328ac47 100644 --- a/lib/task_bunny/job.ex +++ b/lib/task_bunny/job.ex @@ -49,11 +49,11 @@ defmodule TaskBunny.Job do # Retry - By default TaskBunny retries 10 times every five minutes for a failed job. + By default TaskBunny retries after at least five minutes, up to 10 times for a failed job. You can change this by overriding `max_retry/0` and `retry_interval/1`. For example, if you want the job to be retried five times and gradually - increase the interval based on failed times, you can write logic like + increase the minimal interval based on failed times, you can write logic like the following: defmodule HttpSyncJob do