Number of workers is always <20
Each worker listens for max 2h, then shuts itself down and a new process is spawned (not a fork, completely new php shell process).
$gmworker = new GearmanWorker(); $gmworker->addOptions(GEARMAN_WORKER_GRAB_UNIQ); $gmworker->setTimeout(5000); $gmworker->addFunction($funcName, array($this,'workGearman'))
main loop (with fat removed):
while( !$this->_signal && ( @$gmworker->work() || $gmworker->returnCode() == GEARMAN_TIMEOUT ) && !$this->_signal ){ // nothing unusual happened, run another loop iteration $db->closeConnection(); $log->debug('Waiting for jobs...'); }
Number of workers is always <20
Each worker listens for max 2h, then shuts itself down and a new process is spawned (not a fork, completely new php shell process).
$gmworker = new GearmanWorker(); >addOptions( GEARMAN_ WORKER_ GRAB_UNIQ) ; >setTimeout( 5000); >addFunction( $funcName, array($ this,'workGearm an'))
$gmworker-
$gmworker-
$gmworker-
main loop (with fat removed):
while( >work() || >returnCode( ) == GEARMAN_TIMEOUT >closeConnectio n(); >debug( 'Waiting for jobs...');
!$this->_signal &&
(
@$gmworker-
$gmworker-
) && !$this->_signal
){
// nothing unusual happened, run another loop iteration
$db-
$log-
}