From: Lucas Rolff Date: Wed, 17 Apr 2024 14:57:49 +0000 (+0800) Subject: [Minor] Move hostname resolution up to cache it X-Git-Tag: 3.9.0~66^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F4926%2Fhead;p=thirdparty%2Frspamd.git [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 --- diff --git a/lualib/lua_selectors/extractors.lua b/lualib/lua_selectors/extractors.lua index 7a7f41a2f0..97db650445 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', },