summaryrefslogtreecommitdiff
path: root/lib/GitHub/Collector/Role/Pause.pm
blob: ba7a77983abbc05a8720adbcea8dbf8f9c1fed3c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package GitHub::Collector::Role::Pause;

use Moose::Role;

has pause_on_error => (
    is      => 'ro',
    isa     => 'Int',
    default => 10,
);

sub pause {
    my $self = shift;
    my $rand = int(rand(10));
    my $pause = $rand == 1 ? $rand : 0;
    sleep($pause);
}

1;