From 352e35b245ba850cbb39f0fc07777e727f99484a Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 28 Sep 2015 18:41:22 +0100 Subject: [PATCH] Preserve expired fuzzy hashes counter. --- src/fuzzy_storage.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/fuzzy_storage.c b/src/fuzzy_storage.c index 016f0c6e0..159570c1e 100644 --- a/src/fuzzy_storage.c +++ b/src/fuzzy_storage.c @@ -265,12 +265,17 @@ sync_callback (gint fd, short what, void *arg) struct rspamd_worker *worker = (struct rspamd_worker *)arg; struct rspamd_fuzzy_storage_ctx *ctx; gdouble next_check; + guint64 old_expired, new_expired; ctx = worker->ctx; /* Call backend sync */ + old_expired = rspamd_fuzzy_backend_expired (ctx->backend); rspamd_fuzzy_backend_sync (ctx->backend, ctx->expire, TRUE); + new_expired = rspamd_fuzzy_backend_expired (ctx->backend); - server_stat->fuzzy_hashes_expired = rspamd_fuzzy_backend_expired (ctx->backend); + if (old_expired < new_expired) { + server_stat->fuzzy_hashes_expired += new_expired - old_expired; + } /* Timer event */ event_del (&tev); -- 2.39.5