commit edf70f5: [Minor] Skip double message processing

Vsevolod Stakhov vsevolod at highsecure.ru
Sat Oct 12 09:56:05 UTC 2019


Author: Vsevolod Stakhov
Date: 2019-10-12 10:52:33 +0100
URL: https://github.com/rspamd/rspamd/commit/edf70f59c11f1877bda35ad0f85889141a89224f (HEAD -> master)

[Minor] Skip double message processing

---
 src/lua/lua_task.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c
index c3159f16b..5be5b3f94 100644
--- a/src/lua/lua_task.c
+++ b/src/lua/lua_task.c
@@ -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;


More information about the Commits mailing list