Try to remove loop for age

master
Heuzef 5 years ago
parent 8bb85a1191
commit ed9356673d
  1. 8
      Check.pm

@ -51,13 +51,10 @@ sub action
} }
# Age # Age
for ( my $i = 0 ; $i < @Backups ; $i++ ) { if ( $Backups{type} eq "full" or "incr" ) {
if ( $Backups[$i]{type} eq "full" or "incr" ) { $lastAge = sprintf("%.1f", (time - $Backups[-1]{startTime}) / (24 * 3600));
$lastAge = sprintf("%.1f", (time - $Backups[-1]{startTime}) / (24 * 3600));
}
} }
# Color for age # Color for age
if ( $lastAge < $frequency ) { if ( $lastAge < $frequency ) {
$lastAgeColor = "MediumSeaGreen"; $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) # 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; my $i = ( $Backups[-1]->{type} =~ m/^full|incr$/ ) ? -1 : -2;
$new_size = $Backups[$i]->{sizeNew}; $new_size = $Backups[$i]->{sizeNew};
$new_size_avg = int $sizes->mean; $new_size_avg = int $sizes->mean;
$new_size_q1 = eval { int $sizes->quantile(1) } || 0; $new_size_q1 = eval { int $sizes->quantile(1) } || 0;

Loading…
Cancel
Save