diff options
author | Zach Copley <zach@controlyourself.ca> | 2009-08-06 22:52:58 +0000 |
---|---|---|
committer | Zach Copley <zach@controlyourself.ca> | 2009-08-06 22:52:58 +0000 |
commit | c03d5932877c15eb673febabda5227df2173fbad (patch) | |
tree | f7fc39d212729c1f2677f67b4ee5eccb1d187f18 /lib | |
parent | 421e33f145de0476088f0b802f0b0a9303372b8a (diff) |
Make TwitterStatusFetcher extend ParallelizingDaemon
Diffstat (limited to 'lib')
-rw-r--r-- | lib/parallelizingdaemon.php | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/parallelizingdaemon.php b/lib/parallelizingdaemon.php index 5ecfd98f3..dc28b5643 100644 --- a/lib/parallelizingdaemon.php +++ b/lib/parallelizingdaemon.php @@ -87,7 +87,7 @@ class ParallelizingDaemon extends Daemon function run() { if (isset($this->_debug)) { - echo $this->name() . " - debugging output enabled.\n"; + echo $this->name() . " - Debugging output enabled.\n"; } do { @@ -107,9 +107,10 @@ class ParallelizingDaemon extends Daemon if ($pid) { // Parent + if (isset($this->_debug)) { echo $this->name() . - " (parent) forked new child - pid $pid.\n"; + " - Forked new child - pid $pid.\n"; } @@ -120,22 +121,25 @@ class ParallelizingDaemon extends Daemon // Child // Do something with each object + $this->childTask($o); exit(); } // Remove child from ps list as it finishes + while (($c = pcntl_wait($status, WNOHANG OR WUNTRACED)) > 0) { if (isset($this->_debug)) { - echo $this->name() . " child $c finished.\n"; + echo $this->name() . " - Child $c finished.\n"; } $this->removePs($this->_children, $c); } // Wait! We have too many damn kids. + if (sizeof($this->_children) >= $this->_max_children) { if (isset($this->_debug)) { @@ -158,7 +162,7 @@ class ParallelizingDaemon extends Daemon while (($c = pcntl_wait($status, WUNTRACED)) > 0) { if (isset($this->_debug)) { - echo $this->name() . " child $c finished.\n"; + echo $this->name() . " - Child $c finished.\n"; } $this->removePs($this->_children, $c); |