]> source.dussan.org Git - rspamd.git/commitdiff
[Fix] Do not cache metric result
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 14 Mar 2018 13:43:23 +0000 (13:43 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Wed, 14 Mar 2018 13:43:23 +0000 (13:43 +0000)
src/lua/lua_task.c

index 89f35e90da1a54a91953e82d325fd0c0f8dd3f6a..b0c7c8fd50c6d13c862bc77ddfa5d89558649eaf 100644 (file)
@@ -4180,19 +4180,12 @@ lua_task_get_metric_action (lua_State *L)
        enum rspamd_action_type action;
 
        if (task) {
-               if ((metric_res = task->result) != NULL) {
-                       if (task->result->action == METRIC_ACTION_MAX) {
-                               action = rspamd_check_action_metric (task, metric_res);
-                       }
-                       else {
-                               action = task->result->action;
-                       }
-
-                       lua_pushstring (L, rspamd_action_to_str (action));
-               }
-               else {
-                       lua_pushnil (L);
+               if ((metric_res = task->result) == NULL) {
+                       metric_res = rspamd_create_metric_result (task);
                }
+
+               action = rspamd_check_action_metric (task, metric_res);
+               lua_pushstring (L, rspamd_action_to_str (action));
        }
        else {
                return luaL_error (L, "invalid arguments");