]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Adjust metric score when changing symbol's score
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sun, 8 Oct 2017 10:07:43 +0000 (11:07 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sun, 8 Oct 2017 10:07:43 +0000 (11:07 +0100)
src/lua/lua_task.c

index 12c320b0afa2b3f8ee350ebc5f3226b4908dcf46..c4f4de3fef44387dc8129628da1cd30f93dd3439 100644 (file)
@@ -1263,7 +1263,6 @@ lua_task_adjust_result (lua_State * L)
        const gchar *symbol_name, *param;
        struct rspamd_metric_result *metric_res;
        struct rspamd_symbol_result *s = NULL;
-       struct rspamd_symbol_option *opt;
        double weight;
        gint i, top;
 
@@ -1282,7 +1281,9 @@ lua_task_adjust_result (lua_State * L)
                }
 
                if (s) {
+                       metric_res->score -= s->score;
                        s->score = weight;
+                       metric_res->score += s->score;
                }
                else {
                        return luaL_error (L, "symbol not found: %s", symbol_name);