Permalink
Browse files

Properly get the maximum age of queues across all Perlbals

  • Loading branch information...
1 parent f4a711d commit 2c421b68ddcd3c847d77f0f5043b4d3d3d1bc38d Abe Hassan committed Feb 2, 2012
Showing with 3 additions and 2 deletions.
  1. +3 −2 contrib/perlbal-check
View
@@ -33,6 +33,7 @@ use IO::Socket::INET;
use Getopt::Long;
use Data::Dumper qw(Dumper);
use YAML qw(LoadFile);
+use List::Util qw(max);
$| = 1;
@@ -366,8 +367,8 @@ sub watch_queues {
$services{$1}->{$3}->{$2};
# Keep tabs on the longest service name.
$maxlen = length($1) if (length($1) > $maxlen);
- if ($3 eq 'age' && $4 > $services{$1}->{$3}->{$2}) {
- $services{$1}->{$3}->{$2} = $4;
+ if ($3 eq 'age') {
+ $services{$1}->{$3}->{$2} = max($services{$1}->{$3}->{$2}, $4);
} else {
$services{$1}->{$3}->{$2} += $4;
}

0 comments on commit 2c421b6

Please sign in to comment.