diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-10-11 14:32:11 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-10-11 14:32:11 +0100 |
commit | f5051a01e8d0c622682f8a282b818ff3a31be01a (patch) | |
tree | 44744ac6cdb87336b63182d87cc8b54a79a034c0 /src/lua | |
parent | 0f9f675d64ce090b4e23397c29635f83dd4b457c (diff) | |
download | rspamd-f5051a01e8d0c622682f8a282b818ff3a31be01a.tar.gz rspamd-f5051a01e8d0c622682f8a282b818ff3a31be01a.zip |
[Rework] Always create result for a task
Diffstat (limited to 'src/lua')
-rw-r--r-- | src/lua/lua_task.c | 11 |
1 files changed, 1 insertions, 10 deletions
diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c index 1fb7313c0..7f2711e19 100644 --- a/src/lua/lua_task.c +++ b/src/lua/lua_task.c @@ -1586,9 +1586,6 @@ lua_task_set_pre_result (lua_State * L) if (action < METRIC_ACTION_MAX && action >= METRIC_ACTION_REJECT) { /* We also need to set the default metric to that result */ - if (!task->result) { - task->result = rspamd_create_metric_result (task); - } task->pre_result.action = action; @@ -4127,10 +4124,6 @@ lua_task_set_settings (lua_State *L) /* Adjust desired actions */ mres = task->result; - if (mres == NULL) { - mres = rspamd_create_metric_result (task); - } - for (i = 0; i < METRIC_ACTION_MAX; i++) { elt = ucl_object_lookup_any (act, rspamd_action_to_str (i), rspamd_action_to_str_alt (i), NULL); @@ -4543,9 +4536,7 @@ lua_task_get_metric_action (lua_State *L) enum rspamd_action_type action; if (task) { - if ((metric_res = task->result) == NULL) { - metric_res = rspamd_create_metric_result (task); - } + metric_res = task->result; action = rspamd_check_action_metric (task, metric_res); lua_pushstring (L, rspamd_action_to_str (action)); |