taskId = $taskId; getInstance()->tidPidTable->set( $this->taskId, ['pid' => $workerPid, 'des' => "$taskName::$methodName", 'start_time' => time()] ); if ($context) { $PGLog = null; $PGLog = clone getInstance()->log; $PGLog->logId = $context->getLogId(); $PGLog->accessRecord['beginTime'] = microtime(true); $PGLog->accessRecord['uri'] = $context->getInput()->getPathInfo(); $PGLog->pushLog('task', $taskName); $PGLog->pushLog('method', $methodName); defined('SYSTEM_NAME') && $PGLog->channel = SYSTEM_NAME . '-task'; $PGLog->init(); // 构造请求上下文成员 $context->setLogId($PGLog->logId); $context->setLog($PGLog); $context->setObjectPool($objectPool); $this->setContext($context); } } /** * 销毁 */ public function destroy() { $this->taskId && getInstance()->tidPidTable->del($this->taskId); parent::destroy(); $this->taskId = 0; } }