change sleep_rand to sleep_timer
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/71098513 Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/71098513 Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/71098513 Branch: refs/heads/master Commit: 7109851317433a0fa66f06c6351e38cba0620d73 Parents: 7d406ee Author: Derek Gelinas <mrdgeli...@gmail.com> Authored: Thu Mar 2 19:36:02 2017 +0000 Committer: Jeremy Mitchell <mitchell...@gmail.com> Committed: Thu Mar 16 15:08:24 2017 -0600 ---------------------------------------------------------------------- traffic_ops/bin/traffic_ops_ort.pl | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/71098513/traffic_ops/bin/traffic_ops_ort.pl ---------------------------------------------------------------------- diff --git a/traffic_ops/bin/traffic_ops_ort.pl b/traffic_ops/bin/traffic_ops_ort.pl index 1164b0f..86fabfa 100755 --- a/traffic_ops/bin/traffic_ops_ort.pl +++ b/traffic_ops/bin/traffic_ops_ort.pl @@ -853,6 +853,7 @@ sub check_revalidate_state { sub check_syncds_state { my $syncds_update = 0; + my $random_duration = int( rand($dispersion) ); ( $log_level >> $DEBUG ) && print "DEBUG Checking syncds state.\n"; if ( $script_mode == $SYNCDS || $script_mode == $BADASS || $script_mode == $REPORT ) { @@ -865,7 +866,7 @@ sub check_syncds_state { if (defined($reval_pending) ) { $reval_in_use = 1; } - ( $dispersion > 0 ) && &sleep_rand($dispersion); + ( $dispersion > 0 ) && &sleep_timer($random_duration); $upd_ref = &lwp_get($url); if ( $upd_ref =~ m/^\d{3}$/ ) { @@ -908,7 +909,7 @@ sub check_syncds_state { if ( $script_mode == $SYNCDS ) { if ( $dispersion > 0 ) { ( $log_level >> $WARN ) && print "WARN In syncds mode, sleeping for " . $dispersion . "s to see if the update my parents need is cleared.\n"; - ( $dispersion > 0 ) && &sleep_rand($dispersion, 1); + ( $dispersion > 0 ) && &sleep_timer($dispersion); #for ( my $i = $dispersion; $i > 0; $i-- ) { # ( $log_level >> $WARN ) && print "."; # sleep 1; @@ -946,7 +947,7 @@ sub check_syncds_state { if ( $script_mode == $SYNCDS ) { if ( $dispersion > 0 ) { ( $log_level >> $WARN ) && print "WARN In syncds mode, sleeping for " . $dispersion . "s to see if the update my parents need is cleared.\n"; - ( $dispersion > 0 ) && &sleep_rand($dispersion, 1); + ( $dispersion > 0 ) && &sleep_timer($dispersion); #for ( my $i = $dispersion; $i > 0; $i-- ) { # ( $log_level >> $WARN ) && print "."; # sleep 1; @@ -1043,13 +1044,8 @@ sub check_syncds_state { return ($syncds_update); } -sub sleep_rand { - my $dispersal = shift; - my $full_duration = shift; - my $duration = $dispersal; - if ( !defined($full_duration) ) { - $duration = int( rand($dispersal) ); - } +sub sleep_timer { + my $duration = shift; my $proper_script_mode = $script_mode;