]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Fix sequencing to unbreak lua-records-exec-limit.
authorMiod Vallat <miod.vallat@powerdns.com>
Wed, 5 Mar 2025 06:49:36 +0000 (07:49 +0100)
committerMiod Vallat <miod.vallat@powerdns.com>
Wed, 5 Mar 2025 08:27:09 +0000 (09:27 +0100)
pdns/lua-record.cc
regression-tests.auth-py/test_LuaRecords.py

index 0be78eae3a74f53d5966291e7cf2a03539d094e4..fdf22fa3f40b7604586449bd04cdc05d829156a9 100644 (file)
@@ -1590,14 +1590,14 @@ static std::unordered_map<std::string, int> 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<string>& 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();
     });
index 23c06bcf9a20f64c7f20e3e1d79c6b184511ec2c..4da6b86f54fe3b54fc95a5b5d9c0cb4a94486592 100644 (file)
@@ -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):