From d736642d6ea3ae42de3a30f39881c88a00e1a1f9 Mon Sep 17 00:00:00 2001 From: n-peugnet Date: Wed, 22 Sep 2021 14:38:24 +0200 Subject: fix findSimilarChunk max is not updated --- repo.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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) { -- cgit v1.2.3