summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2018-09-12 23:04:23 +0200
committerFlorian Pritz <bluewind@xinu.at>2018-09-12 23:07:47 +0200
commit4baa43e7ab2995e82ea918503b7de9c1db1d31f6 (patch)
tree69fc1e0409b1166a091318b3a19165ea3c2518bb
parent02f5bf83435fd26850a8c093783f6240a76a5fda (diff)
downloadApp-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>
-rw-r--r--lib/App/BorgRestore/PathTimeTable/DB.pm18
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});