diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-02-29 14:59:26 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-02-29 14:59:26 +0000 |
commit | 79fd689cb7f99dbd150e98d413d7c015aa143fca (patch) | |
tree | e289a2ed8f52044845b1e7077db1a54103c7b160 /src/fuzzy_storage.c | |
parent | b7dd1410aee70091302217f1455ad88dea16945c (diff) | |
download | rspamd-79fd689cb7f99dbd150e98d413d7c015aa143fca.tar.gz rspamd-79fd689cb7f99dbd150e98d413d7c015aa143fca.zip |
[Minor] Fix closing race in fuzzy storage
Diffstat (limited to 'src/fuzzy_storage.c')
-rw-r--r-- | src/fuzzy_storage.c | 7 |
1 files changed, 5 insertions, 2 deletions
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)); |