From: Vsevolod Stakhov Date: Thu, 1 Aug 2024 11:53:03 +0000 (+0100) Subject: [Minor] Fix logic of the checks X-Git-Tag: 3.10.0~65^2~5^2~1 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=645f327b7702aca39017dc0ab92c8641b40d4416;p=rspamd.git [Minor] Fix logic of the checks --- 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; } } }