aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua/lua_task.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-03-14 13:43:23 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-03-14 13:43:23 +0000
commit77d8fb13d64763071febb3980c016c5f4976b70d (patch)
tree4b4bbefa038648678bc99b5081ceb95912cc682b /src/lua/lua_task.c
parent21fa2b4bb6060474d3cf3317e39763a8d9e700d9 (diff)
downloadrspamd-77d8fb13d64763071febb3980c016c5f4976b70d.tar.gz
rspamd-77d8fb13d64763071febb3980c016c5f4976b70d.zip
[Fix] Do not cache metric result
Diffstat (limited to 'src/lua/lua_task.c')
-rw-r--r--src/lua/lua_task.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c
index 89f35e90d..b0c7c8fd5 100644
--- a/src/lua/lua_task.c
+++ b/src/lua/lua_task.c
@@ -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");