From 9bd1c95a71814cc818fe270e5e312b40d197f609 Mon Sep 17 00:00:00 2001 From: Thomas Lamprecht Date: Thu, 31 Aug 2023 15:21:30 +0200 Subject: [PATCH] offline migration: use telling variable for capture group With that the if/else branches are pretty clear, so drop the rather noisy comments that describe what one can get from the code already anyway. Signed-off-by: Thomas Lamprecht --- src/PVE/Storage.pm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/PVE/Storage.pm b/src/PVE/Storage.pm index 7990e0e..8ad493f 100755 --- a/src/PVE/Storage.pm +++ b/src/PVE/Storage.pm @@ -826,13 +826,13 @@ sub storage_migrate { my $line = shift; my $show = 1; - # rate-limit dd logs - if ($line =~ /(?:\d+ bytes)(?:.+?copied, )(\d+) s/) { - if ($1 < 60) { # if < 60s, print every 3s + if ($line =~ /(?:\d+ bytes)(?:.+?copied, )(\d+) s/) { # rate-limit dd logs + my $elapsed = int($1); + if ($elapsed < 60) { $show = !($1 % 3); - } elsif ($1 < 600) { # if < 10mins, print every 10s + } elsif ($elapsed < 600) { $show = !($1 % 10); - } else { # else, print every 30s + } else { $show = !($1 % 30); } }