aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLucas Rolff <lucas@lucasrolff.com>2024-04-17 22:57:49 +0800
committerLucas Rolff <lucas@lucasrolff.com>2024-04-17 22:57:49 +0800
commit104cf0cfd71f50078cf7a7eae72de0675e546c00 (patch)
treebc400adc487b7ce18742420a2d665726d055334c
parent458e980062a56bad80c6dda2eaffca2b5929bf9e (diff)
downloadrspamd-104cf0cfd71f50078cf7a7eae72de0675e546c00.tar.gz
rspamd-104cf0cfd71f50078cf7a7eae72de0675e546c00.zip
[Minor] Move hostname resolution up to cache it
Instead of calling get_hostname() for every processed message, we instead reuse the variable value from rspamd boot time
-rw-r--r--lualib/lua_selectors/extractors.lua4
1 files changed, 3 insertions, 1 deletions
diff --git a/lualib/lua_selectors/extractors.lua b/lualib/lua_selectors/extractors.lua
index 7a7f41a2f..97db65044 100644
--- a/lualib/lua_selectors/extractors.lua
+++ b/lualib/lua_selectors/extractors.lua
@@ -25,6 +25,8 @@ local maps = require "lua_selectors/maps"
local E = {}
local M = "selectors"
+local HOSTNAME = rspamd_util.get_hostname()
+
local url_flags_ts = ts.array_of(ts.one_of(lua_util.keys(rspamd_url.flags))):is_optional()
local function gen_exclude_flags_filter(exclude_flags)
@@ -563,7 +565,7 @@ The first argument must be header name.]],
},
['rspamd_hostname'] = {
['get_value'] = function(task)
- return rspamd_util.get_hostname(), 'string'
+ return HOSTNAME, 'string'
end,
['description'] = 'Get hostname of the filter server',
},