summaryrefslogtreecommitdiff
path: root/lib/GitHub/Collector/Role/Pause.pm
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lib/GitHub/Collector/Role/Pause.pm18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/GitHub/Collector/Role/Pause.pm b/lib/GitHub/Collector/Role/Pause.pm
new file mode 100644
index 0000000..ba7a779
--- /dev/null
+++ b/lib/GitHub/Collector/Role/Pause.pm
@@ -0,0 +1,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;