From dbb777ce5bc1000ea18958a7a62735773197672e Mon Sep 17 00:00:00 2001 From: Mattia Giuffrida Date: Thu, 31 Dec 2020 11:11:33 +0000 Subject: [PATCH] Improves retry middleware documentation. Fixes #1207 --- docs/middleware/request/retry.md | 2 +- lib/faraday/request/retry.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/middleware/request/retry.md b/docs/middleware/request/retry.md index aec7952bb..f1115042d 100644 --- a/docs/middleware/request/retry.md +++ b/docs/middleware/request/retry.md @@ -110,7 +110,7 @@ retry_options = { ### Call a block on every retry -You can specify a block through the `retry_block` option that will be called every time the request is retried. +You can specify a block through the `retry_block` option that will be called before every retry. There are many different applications for this feature, spacing from instrumentation to monitoring. Request environment, middleware options, current number of retries and the exception is passed to the block as parameters. For example, you might want to keep track of the response statuses: diff --git a/lib/faraday/request/retry.rb b/lib/faraday/request/retry.rb index 3159af201..312af1c8d 100644 --- a/lib/faraday/request/retry.rb +++ b/lib/faraday/request/retry.rb @@ -112,7 +112,7 @@ def retry_statuses # not independent of the retry count. This would be useful # if the exception produced is non-recoverable or if the # the HTTP method called is not idempotent. - # @option options [Block] :retry_block block that is executed after + # @option options [Block] :retry_block block that is executed before # every retry. Request environment, middleware options, current number # of retries and the exception is passed to the block as parameters. # @option options [Array] :retry_statuses Array of Integer HTTP status