scan(); $empty_times = 0; while (true) { pcntl_signal_dispatch(); if ($this->_stop) { exit; } Log::record("queue on looper......",Log::DEBUG); $content = $worker->pop($queues,1); if(is_array($content)) { $method = key($content); $arg = current($content); $argx = json_encode($arg,JSON_UNESCAPED_UNICODE); Log::record("method={$method} args={$argx}",Log::DEBUG); $result = $logic_queue->$method($arg); if (!$result['state']) { $this->log($result['msg'],false); } $empty_times = 0; } else { $empty_times ++; if($empty_times > 600) { $model = Model(); $model->checkActive(); unset($model); $empty_times = 0; } } } } private function sig_handler($signo) { Log::record("queue quit at sig_handler.",Log::DEBUG); switch($signo) { case SIGINT: case SIGHUP: case SIGQUIT: case SIGTERM: $this->_stop = true; break; default: break; } } }