]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Try to fix passthrough results processing logic
authorVsevolod Stakhov <vsevolod@rspamd.com>
Tue, 26 Jul 2022 22:44:20 +0000 (23:44 +0100)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Tue, 26 Jul 2022 22:44:20 +0000 (23:44 +0100)
src/libserver/symcache/symcache_runtime.cxx

index f406a1d5873a047748cc878d305bddcb9748f737..0d3594a8b342fe4eb0eedf17977d0b19b0ac03a9 100644 (file)
@@ -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;