From 6f69aff712a6f7935d1316fa0ca01432942fae58 Mon Sep 17 00:00:00 2001 From: Gilbert Chen Date: Mon, 27 Nov 2017 23:36:09 -0500 Subject: [PATCH] Disable caching when retriving files in SnapshotManager --- src/duplicacy_snapshotmanager.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/duplicacy_snapshotmanager.go b/src/duplicacy_snapshotmanager.go index 82db18d..41c0d8e 100644 --- a/src/duplicacy_snapshotmanager.go +++ b/src/duplicacy_snapshotmanager.go @@ -1113,6 +1113,14 @@ func (manager *SnapshotManager) RetrieveFile(snapshot *Snapshot, file *Entry, ou manager.CreateChunkDownloader() + // Temporarily disable the snapshot cache of the download so that downloaded file chunks won't be saved + // to the cache. + snapshotCache := manager.chunkDownloader.snapshotCache + manager.chunkDownloader.snapshotCache = nil + defer func() { + manager.chunkDownloader.snapshotCache = snapshotCache + }() + fileHasher := manager.config.NewFileHasher() alternateHash := false if strings.HasPrefix(file.Hash, "#") {