summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-02-26 11:55:14 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-02-26 11:55:14 +0000
commit0ab3629d70323576c59c160c9658d3a70c80df40 (patch)
tree2cc9ffcb0bc6cf9e35fac9d942669879375b000e
parent34a6bf56c735e54c5e8a8e4e34782bb83219c236 (diff)
downloadrspamd-0ab3629d70323576c59c160c9658d3a70c80df40.tar.gz
rspamd-0ab3629d70323576c59c160c9658d3a70c80df40.zip
Implement versioning in symbols cache to allow modiifications on fly
-rw-r--r--src/libserver/symbols_cache.c4
1 files changed, 3 insertions, 1 deletions
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 "