]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Configurable delay between queuedaemon.php spawns/respawns to help stagger out startu...
authorBrion Vibber <brion@pobox.com>
Tue, 9 Feb 2010 20:39:31 +0000 (12:39 -0800)
committerBrion Vibber <brion@pobox.com>
Tue, 9 Feb 2010 22:27:33 +0000 (14:27 -0800)
$config['queue']['spawndelay'] = 1;

lib/default.php
lib/spawningdaemon.php

index 485a08ba44e427a4ffc4bb341ed955b0dc204775..bf4b83718d04dd4e934d626bbd31a30618e04c56 100644 (file)
@@ -88,6 +88,7 @@ $default =
               'stomp_manual_failover' => true, // if multiple servers are listed, treat them as separate (enqueue on one randomly, listen on all)
               'monitor' => null, // URL to monitor ping endpoint (work in progress)
               'softlimit' => '90%', // total size or % of memory_limit at which to restart queue threads gracefully
+              'spawndelay' => 1, // Wait at least N seconds between (re)spawns of child processes to avoid slamming the queue server with subscription startup
               'debug_memory' => false, // true to spit memory usage to log
               'inboxes' => true, // true to do inbox distribution & output queueing from in background via 'distrib' queue
               ),
index b1961d68801c308fc25429a4cee80b028439f72d..862cbb4fa342b88b735a68c60481cfff26a620f5 100644 (file)
@@ -83,6 +83,7 @@ abstract class SpawningDaemon extends Daemon
                 $this->log(LOG_INFO, "Spawned thread $i as pid $pid");
                 $children[$i] = $pid;
             }
+            sleep(common_config('queue', 'spawndelay'));
         }
         
         $this->log(LOG_INFO, "Waiting for children to complete.");
@@ -111,6 +112,7 @@ abstract class SpawningDaemon extends Daemon
                         $this->log(LOG_INFO, "Respawned thread $i as pid $pid");
                         $children[$i] = $pid;
                     }
+                    sleep(common_config('queue', 'spawndelay'));
                 } else {
                     $this->log(LOG_INFO, "Thread $i pid $pid exited with status $exitCode; closing out thread.");
                 }