]> granicus.if.org Git - pdns/commitdiff
rec: REALLY restrict maintenance() callback to worker threads
authorCharles-Henri Bruyand <charles-henri.bruyand@open-xchange.com>
Wed, 6 Jun 2018 07:22:12 +0000 (09:22 +0200)
committerCharles-Henri Bruyand <charles-henri.bruyand@open-xchange.com>
Wed, 6 Jun 2018 07:22:12 +0000 (09:22 +0200)
pdns/pdns_recursor.cc

index 8f059369f66e96b32bf7180bfe136ad45c7378db..def4cd11b800ebae982d82c274ba0cf5e3d72ebd 100644 (file)
@@ -3556,11 +3556,14 @@ try
         last_carbon = g_now.tv_sec;
       }
     }
-    if (worker && t_pdl != nullptr) {
+    if (t_pdl != nullptr) {
       // lua-dns-script directive is present, call the maintenance callback if needed
-      if(g_now.tv_sec - last_lua_maintenance >= luaMaintenanceInterval) {
-        t_pdl->maintenance();
-        last_lua_maintenance = g_now.tv_sec;
+      if (worker && (!g_weDistributeQueries || t_id != s_distributorThreadID)) {
+        // Only on threads processing queries
+        if(g_now.tv_sec - last_lua_maintenance >= luaMaintenanceInterval) {
+          t_pdl->maintenance();
+          last_lua_maintenance = g_now.tv_sec;
+        }
       }
     }