From: Vsevolod Stakhov Date: Mon, 29 Feb 2016 14:59:26 +0000 (+0000) Subject: [Minor] Fix closing race in fuzzy storage X-Git-Tag: 1.2.0~144 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=79fd689cb7f99dbd150e98d413d7c015aa143fca;p=rspamd.git [Minor] Fix closing race in fuzzy storage --- diff --git a/src/fuzzy_storage.c b/src/fuzzy_storage.c index b847d7865..e4679afe5 100644 --- a/src/fuzzy_storage.c +++ b/src/fuzzy_storage.c @@ -210,7 +210,9 @@ rspamd_fuzzy_process_updates_queue (struct rspamd_fuzzy_storage_ctx *ctx) gpointer ptr; guint nupdates = 0; - if (rspamd_fuzzy_backend_prepare_update (ctx->backend)) { + if (ctx->updates_pending && + g_queue_get_length (ctx->updates_pending) > 0 && + rspamd_fuzzy_backend_prepare_update (ctx->backend)) { cur = ctx->updates_pending->head; while (cur) { io_cmd = cur->data; @@ -254,7 +256,8 @@ rspamd_fuzzy_process_updates_queue (struct rspamd_fuzzy_storage_ctx *ctx) g_queue_get_length (ctx->updates_pending)); } } - else { + else if (ctx->updates_pending && + g_queue_get_length (ctx->updates_pending) > 0) { msg_err ("cannot start transaction in fuzzy backend, " "%ud updates are still pending", g_queue_get_length (ctx->updates_pending));