|  |  
 |   |   
 NAMEAlgorithm::Backoff - Various backoff strategies for retry VERSIONThis document describes version 0.009 of Algorithm::Backoff (from Perl distribution Algorithm-Backoff), released on 2019-06-20. SYNOPSIS # 1. pick a strategy and instantiate
 use Algorithm::Backoff::Constant;
 my $ab = Algorithm::Backoff::Constant->new(
     delay             => 2, # required
     #delay_on_success => 0, # optional, default 0
 );
 # 2. log success/failure and get a new number of seconds to delay, timestamp is
 # optional but must be monotonically increasing.
 my $secs = $ab->failure(); # => 2
 my $secs = $ab->success(); # => 0
 my $secs = $ab->failure(); # => 2
DESCRIPTIONThis distribution provides several classes that implement various backoff strategies for setting delay between retry attempts. This class ("Algorithm::Backoff") is a base class only. METHODSnewUsage: new(%args) -> obj This function is not exported. Arguments ('*' denotes required arguments): 
 Return value: (obj) successUsage: my $secs = $obj->success([ $timestamp ]); Log a successful attempt. If not specified, $timestamp defaults to current time. Will return the suggested number of seconds to wait before doing another attempt. failureUsage: my $secs = $obj->failure([ $timestamp ]); Log a failed attempt. If not specified, $timestamp defaults to current time. Will return the suggested number of seconds to wait before doing another attempt, or -1 if it suggests that one gives up (e.g. if "max_attempts" parameter has been exceeded). HOMEPAGEPlease visit the project's homepage at <https://metacpan.org/release/Algorithm-Backoff>. SOURCESource repository is at <https://github.com/perlancar/perl-Algorithm-Backoff>. BUGSPlease report any bugs or feature requests on the bugtracker website <https://rt.cpan.org/Public/Dist/Display.html?Name=Algorithm-Backoff> When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature. SEE ALSORetry::Backoff - an application of Algorithm::Backoff to retry a piece of code using various backoff strategies. App::AlgorithmBackoffUtils - various CLI's related to Algorithm::Backoff. Action::Retry - Somehow I didn't find this module before writing Algorithm::Backoff. Otherwise I probably would not have created Algorithm::Backoff. But Algorithm::Backoff offers an alternative interface, some additional parameters (like delay on success and jitter factor), a lighter footprint (no Moo), and a couple more strategies. AUTHORperlancar <perlancar@cpan.org> COPYRIGHT AND LICENSEThis software is copyright (c) 2019 by perlancar@cpan.org. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. 
 
 |