Algorithm-Retry

 view release on metacpan or  search on metacpan

lib/Algorithm/Retry/Constant.pm  view on Meta::CPAN

package Algorithm::Retry::Constant;

our $DATE = '2019-04-10'; # DATE
our $VERSION = '0.002'; # VERSION

use strict;
use warnings;

use parent qw(Algorithm::Retry);

our %SPEC;

$SPEC{new} = {
    v => 1.1,
    is_class_meth => 1,
    is_func => 0,
    args => {
        %Algorithm::Retry::attr_consider_actual_delay,
        %Algorithm::Retry::attr_max_attempts,
        %Algorithm::Retry::attr_jitter_factor,
        %Algorithm::Retry::attr_delay_on_success,
        delay => {
            summary => 'Number of seconds to wait after a failure',
            schema => 'ufloat*',
            req => 1,
        },
    },
    result_naked => 1,
    result => {
        schema => 'obj*',
    },
};

sub _success {
    my ($self, $timestamp) = @_;
    $self->{delay_on_success};
}

sub _failure {
    my ($self, $timestamp) = @_;
    $self->{delay};
}

1;
# ABSTRACT: Retry using a constant wait time

__END__

=pod

=encoding UTF-8

=head1 NAME

Algorithm::Retry::Constant - Retry using a constant wait time

=head1 VERSION

This document describes version 0.002 of Algorithm::Retry::Constant (from Perl distribution Algorithm-Retry), released on 2019-04-10.

=head1 SYNOPSIS

 use Algorithm::Retry::Constant;

 # 1. instantiate

 my $ar = Algorithm::Retry::Constant->new(
     #consider_actual_delay => 1, # optional, default 0
     #max_attempts     => 0, # optional, default 0 (retry endlessly)



( run in 4.057 seconds using v1.01-cache-2.11-cpan-56fb94df46f )