Skip to content

[question/enhanchment] is it possible to reset the retry delay? #341

Description

@bertbaron

I'm using failsafe for a job that should run 'forever' with the following code:

        RetryPolicy<Object> retryPolicy = RetryPolicy.builder()
                .withMaxRetries(-1)
                .withBackoff(Duration.ofSeconds(2), Duration.ofMinutes(2), 2.0)
                .onFailedAttempt(event -> log.warn("Backoff from failure", event.getLastException()))
                .build();
        var future = Failsafe.with(retryPolicy)
                .with(executor)
                .runAsync(this::runOnce);

Is there a way to reset the backoff delay to the initial delay when the job has been running for a given duration (say half an hour)? Or would it be an option to add a backoffReset duration?

If there is a better way to achieve my use case then please let me know.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions