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.
This commit is contained in:
Peter J. Holzer 2021-01-31 13:39:59 +01:00
parent 164e6ab553
commit 0cbf922eda
1 changed files with 4 additions and 2 deletions

View File

@ -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;