From ed9356673de8d7ba60d2fed7847ce3328a85baec Mon Sep 17 00:00:00 2001 From: Heuzef Date: Fri, 25 Oct 2019 10:38:19 +0200 Subject: [PATCH] Try to remove loop for age --- Check.pm | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/Check.pm b/Check.pm index 9591d66..61fb301 100644 --- a/Check.pm +++ b/Check.pm @@ -51,13 +51,10 @@ sub action } # Age - for ( my $i = 0 ; $i < @Backups ; $i++ ) { - if ( $Backups[$i]{type} eq "full" or "incr" ) { - $lastAge = sprintf("%.1f", (time - $Backups[-1]{startTime}) / (24 * 3600)); - } + if ( $Backups{type} eq "full" or "incr" ) { + $lastAge = sprintf("%.1f", (time - $Backups[-1]{startTime}) / (24 * 3600)); } - # Color for age if ( $lastAge < $frequency ) { $lastAgeColor = "MediumSeaGreen"; @@ -100,7 +97,6 @@ sub action # Ignore the last backup if it's not full or incr (which means it's either partial or active) my $i = ( $Backups[-1]->{type} =~ m/^full|incr$/ ) ? -1 : -2; - $new_size = $Backups[$i]->{sizeNew}; $new_size_avg = int $sizes->mean; $new_size_q1 = eval { int $sizes->quantile(1) } || 0;