note 103291 deleted from gearmanclient.addtask by salathe

From: Date: Fri, 03 Jan 2014 18:50:21 +0000
Subject: note 103291 deleted from gearmanclient.addtask by salathe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-198098@lists.php.net to get a copy of this message
Note Submitter: sfinktah at php dot spamtrak dot org ---- To create a matching worker, capable of executing multiple jobs simultaneously, I came up with this. It's a slight hack, but it works. <?php do { $pid = false; $gmw= new GearmanWorker(); $gmw->addServer(""); $gmw->addFunction("lookup7", "lookup7_fast", $args); @$gmw->work(); } while ($pid); function lookup7_fast($job) { global $pid; if ($pid = pcntl_fork()) { return $job->setReturn(GEARMAN_WORK_STATUS); } return do_work($job->workload()); }; ?>

« previous php.notes (#198098) next »