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 <t.lamprecht@proxmox.com>
This commit is contained in:
Thomas Lamprecht
2023-08-31 15:21:30 +02:00
parent aa82ad5c25
commit 9bd1c95a71

View File

@ -826,13 +826,13 @@ sub storage_migrate {
my $line = shift; my $line = shift;
my $show = 1; my $show = 1;
# rate-limit dd logs if ($line =~ /(?:\d+ bytes)(?:.+?copied, )(\d+) s/) { # rate-limit dd logs
if ($line =~ /(?:\d+ bytes)(?:.+?copied, )(\d+) s/) { my $elapsed = int($1);
if ($1 < 60) { # if < 60s, print every 3s if ($elapsed < 60) {
$show = !($1 % 3); $show = !($1 % 3);
} elsif ($1 < 600) { # if < 10mins, print every 10s } elsif ($elapsed < 600) {
$show = !($1 % 10); $show = !($1 % 10);
} else { # else, print every 30s } else {
$show = !($1 % 30); $show = !($1 % 30);
} }
} }