commit 104cf0c: [Minor] Move hostname resolution up to cache it
Lucas Rolff
lucas at lucasrolff.com
Mon Jul 29 17:55:44 UTC 2024
Author: Lucas Rolff
Date: 2024-04-17 22:57:49 +0800
URL: https://github.com/rspamd/rspamd/commit/104cf0cfd71f50078cf7a7eae72de0675e546c00 (refs/pull/4926/head)
[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
---
lualib/lua_selectors/extractors.lua | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
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',
},
More information about the Commits
mailing list