Description
Add support for limiting maximum retry attempts in TryGetRetryResult
While reviewing the retry mechanism implemented in TryGetRetryResult
, I came across the following TODO:
// TODO: Consider introducing a fixed max number of retries (e.g. max 5 retries).
Currently, retries continue until the specified deadline is reached. While this follows the spec, it could introduce the following risks:
- Unbounded retry loops
- High memory or CPU usage in batch processors (due to prolonged delays)
- Longer blocking operations in simple processors
I’d like to propose introducing a MaxAttempts
threshold (e.g. 5 retries) as a safeguard against excessive retries.
If the team agrees with this direction, I can proceed with the implementation and submit a pull request.
What is the expected behavior?
The retry mechanism will stop after a predefined maximum number of retries (e.g., 5 attempts).
If the maximum retry attempts are reached, the operation will fail without exceeding the deadline, preventing unbounded retries.
Which alternative solutions or features have you considered?
fix
Additional context
No response