File Coverage

blib/lib/Algorithm/Backoff/Constant.pm
Criterion Covered Total %
statement 13 13 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 18 18 100.0


line stmt bran cond sub pod time code
1             package Algorithm::Backoff::Constant;
2              
3             our $DATE = '2019-06-20'; # DATE
4             our $VERSION = '0.008'; # VERSION
5              
6 2     2   111878 use strict;
  2         18  
  2         47  
7 2     2   9 use warnings;
  2         3  
  2         55  
8              
9 2     2   710 use parent qw(Algorithm::Backoff);
  2         474  
  2         10  
10              
11             our %SPEC;
12              
13             $SPEC{new} = {
14             v => 1.1,
15             is_class_meth => 1,
16             is_func => 0,
17             args => {
18             %Algorithm::Backoff::attr_consider_actual_delay,
19             %Algorithm::Backoff::attr_max_actual_duration,
20             %Algorithm::Backoff::attr_max_attempts,
21             %Algorithm::Backoff::attr_jitter_factor,
22             %Algorithm::Backoff::attr_delay_on_success,
23             %Algorithm::Backoff::attr_min_delay,
24             %Algorithm::Backoff::attr_max_delay,
25             delay => {
26             summary => 'Number of seconds to wait after a failure',
27             schema => 'ufloat*',
28             req => 1,
29             },
30             },
31             result_naked => 1,
32             result => {
33             schema => 'obj*',
34             },
35             };
36              
37             sub _success {
38 65     65   87 my ($self, $timestamp) = @_;
39 65         100 $self->{delay_on_success};
40             }
41              
42             sub _failure {
43 77     77   101 my ($self, $timestamp) = @_;
44 77         112 $self->{delay};
45             }
46              
47             1;
48             # ABSTRACT: Backoff using a constant delay
49              
50             __END__