From 0ab3629d70323576c59c160c9658d3a70c80df40 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Fri, 26 Feb 2016 11:55:14 +0000 Subject: [PATCH] Implement versioning in symbols cache to allow modiifications on fly --- src/libserver/symbols_cache.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libserver/symbols_cache.c b/src/libserver/symbols_cache.c index 71dc6787e..59e0ede26 100644 --- a/src/libserver/symbols_cache.c +++ b/src/libserver/symbols_cache.c @@ -121,6 +121,7 @@ struct delayed_cache_condition { struct cache_savepoint { guchar *processed_bits; guint pass; + guint version; struct metric_result *rs; gdouble lim; GPtrArray *waitq; @@ -1215,6 +1216,7 @@ rspamd_symbols_cache_process_symbols (struct rspamd_task * task, checkpoint->processed_bits = rspamd_mempool_alloc0 (task->task_pool, NBYTES (cache->used_items) * 2); checkpoint->waitq = g_ptr_array_new (); + checkpoint->version = cache->used_items; rspamd_mempool_add_destructor (task->task_pool, rspamd_ptr_array_free_hard, checkpoint->waitq); task->checkpoint = checkpoint; @@ -1245,7 +1247,7 @@ rspamd_symbols_cache_process_symbols (struct rspamd_task * task, * If we figure out symbol that has no dependencies satisfied, then * we just save it for another pass */ - for (i = 0; i < (gint)cache->used_items; i ++) { + for (i = 0; i < (gint)checkpoint->version; i ++) { if (rspamd_symbols_cache_metric_limit (task, checkpoint)) { msg_info_task ("<%s> has already scored more than %.2f, so do " "not " -- 2.39.5