From: Charles-Henri Bruyand Date: Wed, 6 Jun 2018 07:22:12 +0000 (+0200) Subject: rec: REALLY restrict maintenance() callback to worker threads X-Git-Tag: dnsdist-1.3.1~26^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2a0276a91d511bc766d485eddcc081f699a82e8a;p=thirdparty%2Fpdns.git rec: REALLY restrict maintenance() callback to worker threads --- diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc index 8f059369f6..def4cd11b8 100644 --- a/pdns/pdns_recursor.cc +++ b/pdns/pdns_recursor.cc @@ -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; + } } }