pub fn should_retry(
_spec_id: &str,
retry_state: &RetryState,
error_log: &str,
config: &FailureConfig,
) -> Result<RetryDecision>Expand description
Determine whether a failed spec should be retried based on retry state, error log and config.
§Arguments
spec_id- The spec ID (for error messages, currently unused)retry_state- Current retry state with attempt counterror_log- The error log content to scan for retryable patternsconfig- Failure configuration with retry settings and patterns
§Returns
Ok(RetryDecision::Retry(delay))- Should retry after the delayOk(RetryDecision::PermanentFailure(reason))- Permanent failure, don’t retryErr(_)- Configuration error
§Edge Cases
- Empty or missing error log → PermanentFailure
- max_retries = 0 → First failure is permanent
- No pattern match → PermanentFailure
- Backoff overflow → Capped at 1 hour
- Multiple pattern matches → Still retryable (OR logic)
- Exceeded max_retries → PermanentFailure