Browse Source

[Minor] Symcache: Stop on non least passthrough results

tags/3.3
Vsevolod Stakhov 2 years ago
parent
commit
5b0be50b94
No account linked to committer's email address

+ 1
- 1
src/libmime/scan_result.c View File

@@ -806,7 +806,7 @@ rspamd_task_add_result_option (struct rspamd_task *task,
return ret;
}

static struct rspamd_action_config *
struct rspamd_action_config *
rspamd_find_action_config_for_action (struct rspamd_scan_result *scan_result,
struct rspamd_action *act)
{

+ 3
- 0
src/libmime/scan_result.h View File

@@ -224,6 +224,9 @@ struct rspamd_action *rspamd_check_action_metric (struct rspamd_task *task,
struct rspamd_passthrough_result **ppr,
struct rspamd_scan_result *scan_result);

struct rspamd_action_config *rspamd_find_action_config_for_action (struct rspamd_scan_result *scan_result,
struct rspamd_action *act);

#ifdef __cplusplus
}
#endif

+ 23
- 0
src/libserver/symcache/symcache_runtime.cxx View File

@@ -20,6 +20,7 @@
#include "libutil/cxx/util.hxx"
#include "libserver/task.h"
#include "libmime/scan_result.h"
#include "utlist.h"
#include "libserver/worker_util.h"
#include <limits>
#include <cmath>
@@ -525,6 +526,28 @@ symcache_runtime::check_metric_limit(struct rspamd_task *task) -> bool
}
}

if (task->result->passthrough_result != nullptr) {
/* We also need to check passthrough results */
auto *pr = task->result->passthrough_result;
DL_FOREACH (task->result->passthrough_result, pr) {
struct rspamd_action_config *act_config =
rspamd_find_action_config_for_action(task->result, pr->action);

/* Skip least results */
if (pr->flags & RSPAMD_PASSTHROUGH_LEAST) {
continue;
}

/* Skip disabled actions */
if (act_config && (act_config->flags & RSPAMD_ACTION_RESULT_DISABLED)) {
continue;
}

/* Immediately stop on non least passthrough action */
return true;
}
}

return false;
}


Loading…
Cancel
Save