aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorn-peugnet <n.peugnet@free.fr>2021-09-22 14:38:24 +0200
committern-peugnet <n.peugnet@free.fr>2021-09-22 14:38:24 +0200
commitd736642d6ea3ae42de3a30f39881c88a00e1a1f9 (patch)
treee8a8be7a79dcc02b88a3942dc68befc0700a0982
parent1b29f83c7f9f8afa4f1ab247513bcacc2507156f (diff)
downloaddna-backup-d736642d6ea3ae42de3a30f39881c88a00e1a1f9.tar.gz
dna-backup-d736642d6ea3ae42de3a30f39881c88a00e1a1f9.zip
fix findSimilarChunk max is not updated
-rw-r--r--repo.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/repo.go b/repo.go
index 03bf9fc..b080cf0 100644
--- a/repo.go
+++ b/repo.go
@@ -516,12 +516,13 @@ func (r *Repo) findSimilarChunk(chunk Chunk) (*ChunkId, bool) {
count += 1
logger.Infof("found %d %d time(s)", id, count)
if count > max {
+ max = count
similarChunk = id
}
similarChunks[*id] = count
}
}
- return similarChunk, similarChunk != nil
+ return similarChunk, max > 0
}
func (r *Repo) tryDeltaEncodeChunk(temp BufferedChunk) (Chunk, bool) {