Commit Graph

11 Commits (de1b651bcc9f9b7acb83c40490587ca422b7791d)

Author SHA1 Message Date
Rutger 594075583c
Added a way to specify custom functions which decide whether a request should be retried or not (#33)
* Add a generic function to the middleware struct for the `Retryable` decision.

The generic function can be used to define custom behaviour to decide whether to retry a request or not.

By default, this function is `Retryable::from_reqwest_response` which is the same as it was before.

* Add a way to create custom retry policies.

A RetryStrategy will dictate what decision will be made based on the result of the sent request.

* Add RetryableStrategy in the `RetryTransientMiddleware` struct instead of the seperate functions

* Add constructor to create a `RetryTransientMiddleware` with a custom `RetryableStrategy`

* Run `cargo fmt`

* Add example code to the `RetryableStrategy` struct

* Run `cargo fmt`

* Updated changelog

* use a trait

* docs

* include latest changes

Co-authored-by: Conrad Ludgate <conrad.ludgate@truelayer.com>
2023-05-22 11:53:31 +01:00
Matthew Gapp f8ff599f50
fix: remove middleware retry limit (#87)
* refactor: Simplify retry middleware in reqwest.

Removed retry limit:

- Remove MAXIMUM_NUMBER_OF_RETRIES metadata and references in middleware.rs
- Correct mispelling: retry_decision to retry_decision in middleware.rs
- Update Retryable matching to only match Retryable::Transient in middleware.rs
- Simplify branching by removing n_past_retries < MAXIMUM_NUMBER_OF_RETRIES condition in middleware.rs

* test: Remove retry cap assertion from test file

remove retry limit assertion test
2023-04-17 13:02:13 +01:00
Léo Gaspard fef18b3506
feat: wasm32-unknown-unknown support (#79)
* feat: wasm32-unknown-unknown support

This replaces task-local-extensions with http's extensions, as http was
already in the dependency closure anyway and the other features of
task-local-extensions (that required an incompatible-with-wasm part of
tokio) were not used anyway.

* feat: have ci check that wasm32-unknown-unknown keeps compiling

* revert back to task-local-extensions

* fix ci

* fix random on wasm

* fix ci again

* bump

---------

Co-authored-by: Conrad Ludgate <conrad.ludgate@truelayer.com>
2023-03-09 11:33:13 +00:00
tl-helge-hoff f854725791
feat: classify io error connection reset by peer (#78)
* feat: classify io error connection reset by peer

* doc: explain tests

* chore: add changelog

* fix: use and_then

* chore: docs and clippy

* chore: bump reqwest-retry to 0.2.1

* fix: use get_source_error_type

* fix: remove unused import

* fix: make clippy happy

* doc: describe canceled
2022-12-02 10:57:24 +01:00
tl-rodrigo-gryzinski e2635c9f8d
Add note about streaming requests in RetryTransientMiddleware docs (#51) 2022-07-21 16:39:15 +01:00
Conrad Ludgate b3f7ce40d3
fix recursion in retry (#49) 2022-07-09 23:34:23 +01:00
Luca Palmieri 525f62039f
Fix clippy lint. (#23) 2021-12-06 16:06:23 +00:00
Alessandro C dc6f1b460f
fix(retry): handle hyper::Error(IncompleteMessage) as Transient (#14) 2021-10-18 12:18:47 +02:00
tl-rodrigo-gryzinski 9c82a35a90
chore: Move to task-local-extensions (#9)
* chore: Move to task-local-extensions
2021-09-28 19:50:23 +01:00
tl-rodrigo-gryzinski b8645f81eb
Include README in crate doctests and improve documentation (#8)
* chore: Improve docs and include some examples in doctests
2021-09-28 19:26:03 +01:00
Rodrigo Gryzinski 7fe55152ec Initial commit 2021-08-13 08:59:58 +01:00