]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Skip double message processing
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 12 Oct 2019 09:52:33 +0000 (10:52 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Sat, 12 Oct 2019 09:52:33 +0000 (10:52 +0100)
src/lua/lua_task.c

index c3159f16bf9c0ae9539521a824d68729615b6768..5be5b3f9452a97fd14ced3bad28acbf84239b7d5 100644 (file)
@@ -1326,11 +1326,19 @@ lua_task_process_message (lua_State *L)
 {
        LUA_TRACE_POINT;
        struct rspamd_task *task = lua_check_task (L, 1);
+       gboolean enforce = FALSE;
 
        if (task != NULL) {
                if (task->msg.len > 0) {
+                       if (lua_isboolean (L, 2)) {
+                               enforce = lua_toboolean (L, 2);
+                       }
+
                        if (rspamd_message_parse (task)) {
-                               if (!(task->flags & RSPAMD_TASK_FLAG_SKIP_PROCESS)) {
+                               if (enforce ||
+                                       (!(task->flags & RSPAMD_TASK_FLAG_SKIP_PROCESS) &&
+                                       !(task->processed_stages & RSPAMD_TASK_STAGE_PROCESS_MESSAGE))) {
+
                                        lua_pushboolean (L, TRUE);
                                        rspamd_message_process (task);
                                        task->processed_stages |= RSPAMD_TASK_STAGE_PROCESS_MESSAGE;