| 1 | # | ||||||||||||||||||||||||||||
| 2 | # This file is part of App-Magpie | ||||||||||||||||||||||||||||
| 3 | # | ||||||||||||||||||||||||||||
| 4 | # This software is copyright (c) 2011 by Jerome Quelin. | ||||||||||||||||||||||||||||
| 5 | # | ||||||||||||||||||||||||||||
| 6 | # This is free software; you can redistribute it and/or modify it under | ||||||||||||||||||||||||||||
| 7 | # the same terms as the Perl 5 programming language system itself. | ||||||||||||||||||||||||||||
| 8 | # | ||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use 5.012; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | package App::Magpie::Action::BSWait; | ||||||||||||||||||||||||||||
| 14 | # ABSTRACT: bswait command implementation | ||||||||||||||||||||||||||||
| 15 | 1 | $App::Magpie::Action::BSWait::VERSION = '2.010'; | |||||||||||||||||||||||||||
| 16 | 1 | ▶ | use LWP::UserAgent; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 17 | 1 | ▶ | use Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 1 | with 'App::Magpie::Role::Logging'; | |||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | 0 | ▶ | sub run { | ||||||||||||||||||||||||||
|
Subroutine
run: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 24 | 0 | my ($self, $opts) = @_; | |||||||||||||||||||||||||||
| 25 | 0 | $self->log( "checking bs wait hint" ); | |||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 0 | my $ua = LWP::UserAgent->new; | |||||||||||||||||||||||||||
| 28 | 0 | $ua->timeout(10); | |||||||||||||||||||||||||||
| 29 | 0 | $ua->env_proxy; | |||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 0 | my $response = $ua->head('http://pkgsubmit.mageia.org/'); | |||||||||||||||||||||||||||
| 32 | 0 | ▶ | $self->log_fatal( $response->status_line ) unless $response->is_success; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | 0 | my $sleep = $response->header( "x-bs-throttle" ); | |||||||||||||||||||||||||||
| 35 | 0 | $self->log( "bs recommends to sleep $sleep seconds" ); | |||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 0 | ▶ | if ( !$opts->{nosleep} && $sleep ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $opts->{"nosleep"} and $sleep
MC/DC0%0/2
not $opts->{"nosleep"} and $sleep
not $opts->{"nosleep"}
$sleep
Truth table0%0/3
not(A) and B
A= not $opts->{"nosleep"}B= $sleep
| |||||||||||||||||||||||||||||
| 38 | 0 | $self->log_debug( "sleeping $sleep seconds" ); | |||||||||||||||||||||||||||
| 39 | 0 | sleep($sleep); | |||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 0 | return $sleep; | |||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | 1 | 1; | |||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | __END__ | ||||||||||||||||||||||||||||