aboutsummaryrefslogtreecommitdiffstats
path: root/src/libmime
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rspamd.com>2024-08-01 12:53:03 +0100
committerVsevolod Stakhov <vsevolod@rspamd.com>2024-08-01 12:53:03 +0100
commit645f327b7702aca39017dc0ab92c8641b40d4416 (patch)
tree19c029c77c8198db673bdf1496d9d64275cc46f8 /src/libmime
parentcddc50cd4e66a874bdfd07c9d27c234e2cd779ad (diff)
downloadrspamd-645f327b7702aca39017dc0ab92c8641b40d4416.tar.gz
rspamd-645f327b7702aca39017dc0ab92c8641b40d4416.zip
[Minor] Fix logic of the checks
Diffstat (limited to 'src/libmime')
-rw-r--r--src/libmime/scan_result.c27
1 files changed, 8 insertions, 19 deletions
diff --git a/src/libmime/scan_result.c b/src/libmime/scan_result.c
index bc7e5ccfd..894ae4f9e 100644
--- a/src/libmime/scan_result.c
+++ b/src/libmime/scan_result.c
@@ -223,7 +223,12 @@ rspamd_check_group_score(struct rspamd_task *task,
}
else if (fabs(*group_score + w) > group_limit) {
/* Reduce weight */
- w = signbit(w) ? -group_limit - *group_score : group_limit - *group_score;
+ double new_w = signbit(w) ? -group_limit - *group_score : group_limit - *group_score;
+ msg_info_task("maximum group score %.2f for group %s has been reached,"
+ " reduce weight of symbol %s from %.2f to %.2f",
+ group_limit,
+ gr->name, symbol, w, new_w);
+ w = new_w;
}
}
@@ -406,15 +411,7 @@ insert_metric_result(struct rspamd_task *task,
}
else if (gr_score) {
*gr_score += cur_diff;
-
- if (cur_diff < diff) {
- /* Reduce */
- msg_debug_metric(
- "group limit %.2f is reached for %s when inserting symbol %s;"
- " reduce score %.2f - %.2f",
- *gr_score, gr->name, symbol, diff, cur_diff);
- diff = cur_diff;
- }
+ diff = cur_diff;
}
}
}
@@ -474,15 +471,7 @@ insert_metric_result(struct rspamd_task *task,
}
else if (gr_score) {
*gr_score += cur_score;
-
- if (cur_score < final_score) {
- /* Reduce */
- msg_debug_metric(
- "group limit %.2f is reached for %s when inserting symbol %s;"
- " reduce score %.2f - %.2f",
- *gr_score, gr->name, symbol, final_score, cur_score);
- final_score = cur_score;
- }
+ final_score = cur_score;
}
}
}