diff options
author | Florian Pritz <bluewind@xinu.at> | 2018-09-12 23:04:23 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2018-09-12 23:07:47 +0200 |
commit | 4baa43e7ab2995e82ea918503b7de9c1db1d31f6 (patch) | |
tree | 69fc1e0409b1166a091318b3a19165ea3c2518bb /lib/App | |
parent | 02f5bf83435fd26850a8c093783f6240a76a5fda (diff) | |
download | App-BorgRestore-4baa43e7ab2995e82ea918503b7de9c1db1d31f6.tar.gz App-BorgRestore-4baa43e7ab2995e82ea918503b7de9c1db1d31f6.tar.xz |
Remove duplicate code by calling add_path in save_nodes
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'lib/App')
-rw-r--r-- | lib/App/BorgRestore/PathTimeTable/DB.pm | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/lib/App/BorgRestore/PathTimeTable/DB.pm b/lib/App/BorgRestore/PathTimeTable/DB.pm index 73dbc5b..c01bbd0 100644 --- a/lib/App/BorgRestore/PathTimeTable/DB.pm +++ b/lib/App/BorgRestore/PathTimeTable/DB.pm @@ -90,23 +90,7 @@ method _add_path_to_db($archive_id, $path,$time) { method save_nodes() { # flush remaining paths to the DB - my $old_cache_path = $self->{current_path_in_cache}; - while ((my $slash_index = rindex($old_cache_path, "/")) != -1) { - $self->{stats}->{cache_invalidation_loop_iterations}++; - my $removed_time = delete $self->{cache}->{$old_cache_path}; - $self->_add_path_to_db($self->{archive_id}, $old_cache_path, $removed_time); - # strip last part of path - $old_cache_path = substr($old_cache_path, 0, $slash_index); - - # update parent timestamp - my $cached = $self->{cache}->{$old_cache_path}; - if (!defined $cached || $cached < $removed_time) { - $log->tracef("Setting cache time for path '%s' to %d", $old_cache_path, $removed_time) if TRACE; - $self->{cache}->{$old_cache_path} = $removed_time; - } - } - # ensure that top level directory is also written - $self->_add_path_to_db($self->{archive_id}, $old_cache_path, $self->{cache}->{$old_cache_path}); + $self->add_path(".", 0); for my $key (keys %{$self->{stats}}) { $log->debugf("Performance counter %s = %s", $key, $self->{stats}->{$key}); |