docs/src/connecting/retrying.md
The Provider can be configured to retry a request upon receiving a io::Error.
Note: Currently all node errors are received as
io::Errors. So, if configured, a retry will happen even if, for example, a transaction failed to verify.
We can configure the number of retry attempts and the retry strategy as detailed below.
RetryConfigThe retry behavior can be altered by giving a custom RetryConfig. It allows for configuring the maximum number of attempts and the interval strategy used.
{{#include ../../../packages/fuels-accounts/src/provider/retry_util.rs:retry_config}}
{{#include ../../../examples/providers/src/lib.rs:configure_retry}}
BackoffBackoff defines different strategies for managing intervals between retry attempts.
Each strategy allows you to customize the waiting time before a new attempt based on the number of attempts made.
Linear(Duration): Default Increases the waiting time linearly with each attempt.Exponential(Duration): Doubles the waiting time with each attempt.Fixed(Duration): Uses a constant waiting time between attempts.{{#include ../../../packages/fuels-accounts/src/provider/retry_util.rs:backoff}}