Fixed bug, clear the next filter instead of the current one

This commit is contained in:
zonyitoo
2020-01-11 23:01:10 +08:00
parent f64a993e7b
commit 33e72c51da
+4 -3
View File
@@ -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`