From 0cbf922edaf226756816d94c44cc276ac773e995 Mon Sep 17 00:00:00 2001 From: "Peter J. Holzer" Date: Sun, 31 Jan 2021 13:39:59 +0100 Subject: [PATCH] Log progress by time instead of count Instead of logging the current file name every 1000 files we now log it every 10 seconds. This makes it easier to see where backup is slow. --- lib/Simba/CA.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/Simba/CA.pm b/lib/Simba/CA.pm index 06f2aea..d76ff74 100644 --- a/lib/Simba/CA.pm +++ b/lib/Simba/CA.pm @@ -232,9 +232,10 @@ sub backup2disk { $list_cfd->printflush("list $target->{dir}\n"); # XXX - encode! close($list_cfd); my $count = 0; + my $last_report = $self->{start_time}; while (<$list_dfd>) { + my $now = time(); if ($target->{timeout}) { - my $now = time(); my $elapsed = $now - $self->{start_time}; $self->log(10, "checking timeout " . $elapsed . " > " . $target->{timeout}); if ($elapsed > $target->{timeout}) { @@ -248,8 +249,9 @@ sub backup2disk { # split into fields chomp; my $f = $self->parse($_); - if ($count % 1000 == 0) { + if ($now - $last_report >= 10) { $self->log(9, "file $count: $f->{name}"); + $last_report = $now; } my $success = 1;