From d5da9deb11c778962357e2731b614f37e0f97994 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 26 Jul 2022 23:44:20 +0100 Subject: [PATCH] [Fix] Try to fix passthrough results processing logic --- src/libserver/symcache/symcache_runtime.cxx | 24 +++++++++++---------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/libserver/symcache/symcache_runtime.cxx b/src/libserver/symcache/symcache_runtime.cxx index f406a1d58..0d3594a8b 100644 --- a/src/libserver/symcache/symcache_runtime.cxx +++ b/src/libserver/symcache/symcache_runtime.cxx @@ -331,7 +331,7 @@ symcache_runtime::process_pre_postfilters(struct rspamd_task *task, if (stage != RSPAMD_TASK_STAGE_IDEMPOTENT && !(item->flags & SYMBOL_TYPE_IGNORE_PASSTHROUGH)) { if (check_metric_limit(task)) { - msg_info_task_lambda("task has already the result being set, ignore further checks"); + msg_debug_cache_task_lambda("task has already the result being set, ignore further checks"); return true; } @@ -361,8 +361,7 @@ symcache_runtime::process_pre_postfilters(struct rspamd_task *task, } } - process_symbol(task, cache, item, dyn_item); - all_done = false; + return process_symbol(task, cache, item, dyn_item); } /* Continue processing */ @@ -396,6 +395,8 @@ auto symcache_runtime::process_filters(struct rspamd_task *task, symcache &cache, int start_events) -> bool { auto all_done = true; + auto log_func = RSPAMD_LOG_FUNC; + auto has_passtrough = false; for (const auto[idx, item]: rspamd::enumerate(order->d)) { /* Exclude all non filters */ @@ -407,6 +408,15 @@ symcache_runtime::process_filters(struct rspamd_task *task, symcache &cache, int break; } + if (!(item->flags & (SYMBOL_TYPE_FINE|SYMBOL_TYPE_IGNORE_PASSTHROUGH))) { + if (has_passtrough || check_metric_limit(task)) { + msg_debug_cache_task_lambda("task has already the result being set, ignore further checks"); + has_passtrough = true; + /* Skip this item */ + continue; + } + } + auto dyn_item = &dynamic_items[idx]; if (!dyn_item->started) { @@ -429,14 +439,6 @@ symcache_runtime::process_filters(struct rspamd_task *task, symcache &cache, int return false; } } - - if (!(item->flags & SYMBOL_TYPE_FINE)) { - if (check_metric_limit(task)) { - msg_info_task("task has already the result being set, ignore further checks"); - all_done = true; - break; - } - } } return all_done; -- 2.39.5