From 33e72c51da8f4edf083e17c1b030fc2e4d1d6008 Mon Sep 17 00:00:00 2001 From: zonyitoo Date: Sat, 11 Jan 2020 23:01:10 +0800 Subject: [PATCH] Fixed bug, clear the next filter instead of the current one --- src/context.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/context.rs b/src/context.rs index 8021349b..40f06f58 100644 --- a/src/context.rs +++ b/src/context.rs @@ -85,11 +85,12 @@ impl PingPongBloom { if self.bloom_count[self.current] >= self.item_count { // Current bloom filter is full, - // Create a new one and use the next one as current. - self.bloom_count[self.current] = 0; - self.blooms[self.current].clear(); + // Create a new one and use that one as current. self.current = (self.current + 1) % 2; + + self.bloom_count[self.current] = 0; + self.blooms[self.current].clear(); } // Cannot be optimized by `check_and_set`