From: Miod Vallat Date: Wed, 5 Mar 2025 06:49:36 +0000 (+0100) Subject: Fix sequencing to unbreak lua-records-exec-limit. X-Git-Tag: dnsdist-2.0.0-alpha1~43^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=dd8a54228b5d49e18a79ff8238c736d69e11d73b;p=thirdparty%2Fpdns.git Fix sequencing to unbreak lua-records-exec-limit. --- diff --git a/pdns/lua-record.cc b/pdns/lua-record.cc index 0be78eae3a..fdf22fa3f4 100644 --- a/pdns/lua-record.cc +++ b/pdns/lua-record.cc @@ -1590,14 +1590,14 @@ static std::unordered_map lua_variables{ static void setupLuaRecords(LuaContext& lua) { - if (g_luaRecordExecLimit > 0) { - lua.executeCode(boost::str(boost::format("debug.sethook(report, '', %d)") % g_luaRecordExecLimit)); - } - lua.writeFunction("report", [](const string& event, const boost::optional& line) -> void { lua_report(event, line); }); + if (g_luaRecordExecLimit > 0) { + lua.executeCode(boost::str(boost::format("debug.sethook(report, '', %d)") % g_luaRecordExecLimit)); + } + lua.writeFunction("latlon", []() -> string { return lua_latlon(); }); diff --git a/regression-tests.auth-py/test_LuaRecords.py b/regression-tests.auth-py/test_LuaRecords.py index 23c06bcf9a..4da6b86f54 100644 --- a/regression-tests.auth-py/test_LuaRecords.py +++ b/regression-tests.auth-py/test_LuaRecords.py @@ -1202,6 +1202,9 @@ class TestLuaRecords(BaseLuaTest): class TestLuaRecordsShared(TestLuaRecords): + # The lua-records-exec-limit parameter needs to be increased from the + # default value of 1000, for the testGeoIPQueryAttribute test would hit + # the limit. _config_template = """ geoip-database-files=../modules/geoipbackend/regression-tests/GeoLiteCity.mmdb edns-subnet-processing=yes @@ -1210,6 +1213,7 @@ any-to-tcp=no enable-lua-records=shared lua-records-insert-whitespace=yes lua-health-checks-interval=1 +lua-records-exec-limit=1500 """ def testCounter(self):