From 04a539f1333f7dfc3b1d6799b16956b576cad3cb Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Fri, 22 Jun 2018 16:28:52 +0100 Subject: [Feature] Add a concept of ignored symbols to avoid race conditions --- src/lua/lua_task.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'src/lua') diff --git a/src/lua/lua_task.c b/src/lua/lua_task.c index ca55609a7..db5bd090a 100644 --- a/src/lua/lua_task.c +++ b/src/lua/lua_task.c @@ -3309,11 +3309,13 @@ lua_task_get_symbols (lua_State *L) while (g_hash_table_iter_next (&it, &k, &v)) { s = v; - lua_pushstring (L, k); - lua_rawseti (L, -3, i); - lua_pushnumber (L, s->score); - lua_rawseti (L, -2, i); - i ++; + if (!(s->flags & RSPAMD_SYMBOL_RESULT_IGNORED)) { + lua_pushstring (L, k); + lua_rawseti (L, -3, i); + lua_pushnumber (L, s->score); + lua_rawseti (L, -2, i); + i++; + } } } else { @@ -3384,14 +3386,17 @@ lua_task_get_symbols_numeric (lua_State *L) g_hash_table_iter_init (&it, mres->symbols); while (g_hash_table_iter_next (&it, &k, &v)) { - id = rspamd_symbols_cache_find_symbol (task->cfg->cache, - k); s = v; - lua_pushnumber (L, id); - lua_rawseti (L, -3, i); - lua_pushnumber (L, s->score); - lua_rawseti (L, -2, i); - i ++; + + if (!(s->flags & RSPAMD_SYMBOL_RESULT_IGNORED)) { + id = rspamd_symbols_cache_find_symbol (task->cfg->cache, + k); + lua_pushnumber (L, id); + lua_rawseti (L, -3, i); + lua_pushnumber (L, s->score); + lua_rawseti (L, -2, i); + i++; + } } } else { -- cgit v1.2.3