Algorithm-Backoff-RetryTimeouts

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN


      This value bypasses any max_actual_duration checks, so the total time
      spent on sleeping and attempts may end up exceeding that value by a
      small amount (up to max_actual_duration + min_adjust_timeout). In
      this case, future failures will return a delay of -1 as expected.

      * timeout_jitter_factor => float (default: 0.1)

      How much randomness to add to the adjustable timeout.

      Delay jitter may not be enough to desynchronize two processes that
      are consistently timing out on the same problem. In those cases, the
      delay will usually be zero and won't have any sort of jitter to solve
      the problem itself. A jitter factor against the timeout will ensure
      simultaneous attempts have slightly different timeout windows.

METHODS

 success

        my ($delay, $timeout) = $retry_algo->success([ $timestamp ]);

README  view on Meta::CPAN

    time. Unlike the base class, this method will return a list containing
    both the suggested delay and the suggested timeout for the next
    attempt.

 delay

        my $delay = $retry_algo->delay;

    Returns the last suggested delay, in seconds.

    The delay will return -1 to suggest that the process should give up and
    fail, if max_attempts or max_actual_duration have been reached.

 timeout

        my $timeout = $retry_algo->delay;

    Returns the last suggested timeout, in seconds. If no attempts have
    been logged, it will suggest an initial timeout to start with.

    This will be a floating-point number, so you may need to convert it to

lib/Algorithm/Backoff/RetryTimeouts.pm  view on Meta::CPAN

#pod
#pod This value bypasses any C<max_actual_duration> checks, so the total time spent on
#pod sleeping and attempts may end up exceeding that value by a small amount (up to
#pod C<max_actual_duration + min_adjust_timeout>).  In this case, future failures will return
#pod a delay of C<-1> as expected.
#pod
#pod =item * timeout_jitter_factor => I<float> (default: 0.1)
#pod
#pod How much randomness to add to the adjustable timeout.
#pod
#pod Delay jitter may not be enough to desynchronize two processes that are consistently
#pod timing out on the same problem.  In those cases, the delay will usually be zero and won't
#pod have any sort of jitter to solve the problem itself.  A jitter factor against the timeout
#pod will ensure simultaneous attempts have slightly different timeout windows.
#pod
#pod =back
#pod
#pod =head1 METHODS
#pod
#pod =head2 success
#pod

lib/Algorithm/Backoff/RetryTimeouts.pm  view on Meta::CPAN


    return ($delay, $timeout);
}

#pod =head2 delay
#pod
#pod     my $delay = $retry_algo->delay;
#pod
#pod Returns the last suggested delay, in seconds.
#pod
#pod The delay will return C<-1> to suggest that the process should give up and fail, if
#pod C<max_attempts> or C<max_actual_duration> have been reached.
#pod
#pod =cut

sub delay {
    my $self = shift;
    return $self->{_prev_delay} // 0;
}

#pod =head2 timeout

lib/Algorithm/Backoff/RetryTimeouts.pm  view on Meta::CPAN


This value bypasses any C<max_actual_duration> checks, so the total time spent on
sleeping and attempts may end up exceeding that value by a small amount (up to
C<max_actual_duration + min_adjust_timeout>).  In this case, future failures will return
a delay of C<-1> as expected.

=item * timeout_jitter_factor => I<float> (default: 0.1)

How much randomness to add to the adjustable timeout.

Delay jitter may not be enough to desynchronize two processes that are consistently
timing out on the same problem.  In those cases, the delay will usually be zero and won't
have any sort of jitter to solve the problem itself.  A jitter factor against the timeout
will ensure simultaneous attempts have slightly different timeout windows.

=back

=head1 METHODS

=head2 success

lib/Algorithm/Backoff/RetryTimeouts.pm  view on Meta::CPAN

Unlike the L<base class|Algorithm::Backoff>, this method will return a list containing
both the L<suggested delay|/delay> and the L<suggested timeout|/timeout> for the next
attempt.

=head2 delay

    my $delay = $retry_algo->delay;

Returns the last suggested delay, in seconds.

The delay will return C<-1> to suggest that the process should give up and fail, if
C<max_attempts> or C<max_actual_duration> have been reached.

=head2 timeout

    my $timeout = $retry_algo->delay;

Returns the last suggested timeout, in seconds.  If no attempts have been logged,
it will suggest an initial timeout to start with.

This will be a floating-point number, so you may need to convert it to an integer if your



( run in 0.246 second using v1.01-cache-2.11-cpan-8d75d55dd25 )