Algorithm-Backoff

 view release on metacpan or  search on metacpan

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

package Algorithm::Backoff::Constant;

use strict;
use warnings;

use parent qw(Algorithm::Backoff);

our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
our $DATE = '2024-02-24'; # DATE
our $DIST = 'Algorithm-Backoff'; # DIST
our $VERSION = '0.010'; # VERSION

our %SPEC;

$SPEC{new} = {
    v => 1.1,
    is_class_meth => 1,
    is_func => 0,
    args => {
        %Algorithm::Backoff::attr_consider_actual_delay,
        %Algorithm::Backoff::attr_max_actual_duration,
        %Algorithm::Backoff::attr_max_attempts,
        %Algorithm::Backoff::attr_jitter_factor,
        %Algorithm::Backoff::attr_delay_on_success,
        %Algorithm::Backoff::attr_min_delay,
        %Algorithm::Backoff::attr_max_delay,
        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: Backoff using a constant delay

__END__

=pod

=encoding UTF-8

=head1 NAME

Algorithm::Backoff::Constant - Backoff using a constant delay

=head1 VERSION

This document describes version 0.010 of Algorithm::Backoff::Constant (from Perl distribution Algorithm-Backoff), released on 2024-02-24.

=head1 SYNOPSIS



( run in 0.426 second using v1.01-cache-2.11-cpan-524268b4103 )