]> granicus.if.org Git - pdns/commitdiff
make sure thread cleaning interval is 1) thread local 2) not all threads start cleani...
authorBert Hubert <bert.hubert@netherlabs.nl>
Mon, 11 Jan 2010 01:56:45 +0000 (01:56 +0000)
committerBert Hubert <bert.hubert@netherlabs.nl>
Mon, 11 Jan 2010 01:56:45 +0000 (01:56 +0000)
git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@1499 d19b8d6e-7fed-0310-83ef-9ca221ded41b

pdns/pdns_recursor.cc

index 3ffcbbcef85b2e7b34acb0a9d2a7e4ec953b9323..afaf0f9c8fc43260a73a51c6e3ddbcd51cb075ff 100644 (file)
@@ -1038,11 +1038,11 @@ void doStats(void)
 static void houseKeeping(void *)
 try
 {
-  static time_t last_stat, last_rootupdate, last_prune;
+  static __thread time_t last_stat, last_rootupdate, last_prune;
   struct timeval now;
   Utility::gettimeofday(&now, 0);
 
-  if(now.tv_sec - last_prune > 300) { 
+  if(now.tv_sec - last_prune > 300 + 3*t_id) { 
     DTime dt;
     dt.setTimeval(now);
     t_RC->doPrune(); // this function is local to a thread, so fine anyhow
@@ -1059,7 +1059,7 @@ try
         SyncRes::t_sstorage->nsSpeeds.erase(i++);
       else
         ++i;
-
+//    L<<Logger::Warning<<"Spent "<<dt.udiff()/1000<<" msec cleaning"<<endl;
     last_prune=time(0);
   }
   if(!t_id) {