Skip to content

Allow limiting retries by elapsed time in RetryPolicy #149

Open

Description

@rawo

Problem

Since #131 (2.0.0) retries back off exponentially, but how long an entry keeps retrying is controlled only indirectly by maxRetries together with initialBackoff, backoffMultiplier, maxBackoff and jitter. To answer "keep retrying for up to 24 hours", users have to work out the retry count from the backoff schedule, and the answer changes whenever any of those settings is tuned.

Proposal

Add an optional elapsed-time limit to RetryPolicy, e.g. maxRetryDuration: Duration? (default null = count-only, the current behaviour):

  • In OutboxEntryProcessor, a retriable failure moves the entry to FAILED once now - createdAt (or the time of the first failed attempt) exceeds maxRetryDuration, or once maxRetries is exhausted, whichever comes first. Consider allowing maxRetries to be unbounded when a duration is set.
  • Clamp the last next_attempt_at so the final attempt happens close to the deadline rather than overshooting it by up to maxBackoff.
  • Spring property okapi.processor.max-retry-duration, plus validation and configuration metadata.
  • Decide and document whether the clock starts at createdAt (includes time waiting in the queue) or at the first failed attempt (would need a column, or deriving it from retries and the backoff schedule).

Compatibility

Additive: a new defaulted parameter on RetryPolicy (@JvmOverloads already in place) and a new optional property. No schema change if the clock starts at createdAt. Fits a 2.x minor release.

Split out of #131 (see the "Out of scope" section of #146).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions