From 4e6d48ea4fe9a3acb0912a6e408af7cb36355327 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Mon, 23 Jul 2018 17:41:21 +0100 Subject: [PATCH] [Minor] Add `trivial` flag for symbols --- src/libserver/symbols_cache.h | 1 + src/lua/lua_config.c | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/libserver/symbols_cache.h b/src/libserver/symbols_cache.h index 4e1c10dc5..2657b07cc 100644 --- a/src/libserver/symbols_cache.h +++ b/src/libserver/symbols_cache.h @@ -43,6 +43,7 @@ enum rspamd_symbol_type { SYMBOL_TYPE_NOSTAT = (1 << 11), /* Skip as statistical symbol */ SYMBOL_TYPE_IDEMPOTENT = (1 << 12), /* Symbol cannot change metric */ SYMBOL_TYPE_SQUEEZED = (1 << 13), /* Symbol is squeezed inside Lua */ + SYMBOL_TYPE_TRIVIAL = (1 << 14), /* Symbol is trivial */ }; /** diff --git a/src/lua/lua_config.c b/src/lua/lua_config.c index 84062d46b..35b7dc332 100644 --- a/src/lua/lua_config.c +++ b/src/lua/lua_config.c @@ -205,6 +205,7 @@ LUA_FUNCTION_DEF (config, get_classifier); * + `empty` if symbol can be called for empty messages * + `skip` if symbol should be skipped now * + `nostat` if symbol should be excluded from stat tokens + * + `trivial` symbol is trivial (e.g. no network requests) * - `parent`: id of parent symbol (useful for virtual symbols) * * @return {number} id of symbol registered @@ -1568,6 +1569,9 @@ lua_parse_symbol_flags (const gchar *str) if (strstr (str, "squeezed") != NULL) { ret |= SYMBOL_TYPE_SQUEEZED; } + if (strstr (str, "trivial") != NULL) { + ret |= SYMBOL_TYPE_TRIVIAL; + } } return ret; -- 2.39.5