line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Algorithm::Backoff::LILD; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $DATE = '2019-06-20'; # DATE |
4
|
|
|
|
|
|
|
our $VERSION = '0.009'; # VERSION |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
54878
|
use strict; |
|
1
|
|
|
|
|
11
|
|
|
1
|
|
|
|
|
25
|
|
7
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
25
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
361
|
use parent qw(Algorithm::Backoff); |
|
1
|
|
|
|
|
259
|
|
|
1
|
|
|
|
|
5
|
|
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_max_delay, |
23
|
|
|
|
|
|
|
%Algorithm::Backoff::attr_min_delay, |
24
|
|
|
|
|
|
|
%Algorithm::Backoff::attr_initial_delay, |
25
|
|
|
|
|
|
|
%Algorithm::Backoff::attr_delay_increment_on_failure, |
26
|
|
|
|
|
|
|
%Algorithm::Backoff::attr_delay_increment_on_success, |
27
|
|
|
|
|
|
|
}, |
28
|
|
|
|
|
|
|
result_naked => 1, |
29
|
|
|
|
|
|
|
result => { |
30
|
|
|
|
|
|
|
schema => 'obj*', |
31
|
|
|
|
|
|
|
}, |
32
|
|
|
|
|
|
|
}; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub _success { |
35
|
4
|
|
|
4
|
|
6
|
my ($self, $timestamp) = @_; |
36
|
|
|
|
|
|
|
|
37
|
4
|
50
|
|
|
|
9
|
unless (defined $self->{_prev_delay}) { |
38
|
0
|
|
|
|
|
0
|
return $self->{_prev_delay} = $self->{initial_delay}; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
4
|
|
|
|
|
7
|
my $delay = $self->{_prev_delay} + $self->{delay_increment_on_success}; |
42
|
|
|
|
|
|
|
|
43
|
4
|
|
|
|
|
6
|
$delay; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub _failure { |
47
|
5
|
|
|
5
|
|
8
|
my ($self, $timestamp) = @_; |
48
|
|
|
|
|
|
|
|
49
|
5
|
100
|
|
|
|
11
|
unless (defined $self->{_prev_delay}) { |
50
|
1
|
|
|
|
|
3
|
return $self->{_prev_delay} = $self->{initial_delay}; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
4
|
|
|
|
|
5
|
my $delay = $self->{_prev_delay} + $self->{delay_increment_on_failure}; |
54
|
|
|
|
|
|
|
|
55
|
4
|
|
|
|
|
8
|
$delay; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
1; |
59
|
|
|
|
|
|
|
# ABSTRACT: Linear Increment, Linear Decrement (LILD) backoff |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
__END__ |