commit d5da9de: [Fix] Try to fix passthrough results processing logic

Vsevolod Stakhov vsevolod at rspamd.com
Tue Jul 26 22:49:03 UTC 2022


Author: Vsevolod Stakhov
Date: 2022-07-26 23:44:20 +0100
URL: https://github.com/rspamd/rspamd/commit/d5da9deb11c778962357e2731b614f37e0f97994 (HEAD -> master)

[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;


More information about the Commits mailing list