From 3f7d85360a2fa90e1cb0d9282db0b76fe9b3c51a Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Thu, 28 Dec 2017 13:18:27 +0100 Subject: [PATCH 1/3] fuse: Only reload list of snapshots once per minute --- internal/fuse/root.go | 6 +++++- internal/fuse/snapshots_dir.go | 7 +++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/internal/fuse/root.go b/internal/fuse/root.go index d6ca78b1b..c6abc3bf2 100644 --- a/internal/fuse/root.go +++ b/internal/fuse/root.go @@ -4,6 +4,8 @@ package fuse import ( + "time" + "github.com/restic/restic/internal/debug" "github.com/restic/restic/internal/restic" @@ -27,7 +29,9 @@ type Root struct { inode uint64 snapshots restic.Snapshots blobSizeCache *BlobSizeCache - snCount int + + snCount int + lastCheck time.Time *MetaDir } diff --git a/internal/fuse/snapshots_dir.go b/internal/fuse/snapshots_dir.go index 47c691fea..19c785224 100644 --- a/internal/fuse/snapshots_dir.go +++ b/internal/fuse/snapshots_dir.go @@ -221,14 +221,21 @@ func isElem(e string, list []string) bool { return false } +const minSnapshotsReloadTime = 60 * time.Second + // update snapshots if repository has changed func updateSnapshots(ctx context.Context, root *Root) { + if time.Since(root.lastCheck) < minSnapshotsReloadTime { + return + } + snapshots := restic.FindFilteredSnapshots(ctx, root.repo, root.cfg.Host, root.cfg.Tags, root.cfg.Paths) if root.snCount != len(snapshots) { root.snCount = len(snapshots) root.repo.LoadIndex(ctx) root.snapshots = snapshots } + root.lastCheck = time.Now() } // read snapshot timestamps from the current repository-state. From 5f9b5b021944242aef239173a3634c32d2426309 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Thu, 28 Dec 2017 13:20:03 +0100 Subject: [PATCH 2/3] Add entry to changelog --- changelog/0.8.2/pull-1507 | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 changelog/0.8.2/pull-1507 diff --git a/changelog/0.8.2/pull-1507 b/changelog/0.8.2/pull-1507 new file mode 100644 index 000000000..8daab8a8f --- /dev/null +++ b/changelog/0.8.2/pull-1507 @@ -0,0 +1,3 @@ +Enhancement: Only reload snapshots once per minute for fuse mount + +https://github.com/restic/restic/pull/1507 From 6d91d468e79ca3ef9efc62ea78aa6f11a4d28fa3 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Thu, 28 Dec 2017 13:20:19 +0100 Subject: [PATCH 3/3] Add entry to releases --- changelog/releases | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog/releases b/changelog/releases index a9d5e3843..92f596d7f 100644 --- a/changelog/releases +++ b/changelog/releases @@ -3,6 +3,7 @@ # # The resulting changelog generated by `calens` will list all versions in # exactly this order. +0.8.2 0.8.1 2017-12-27 0.8.0 2017-11-26 0.7.3 2017-09-20