This commit is contained in:
2021-08-18 11:56:19 +08:00
parent f375eec0a0
commit 99e2f36794
9 changed files with 21 additions and 14 deletions
+2 -2
View File
@@ -77,7 +77,7 @@ class Zookeeper implements CustomProcess
if (empty($handler = $redis->get('crontab:' . $value))) {
return;
}
$server = ServerManager::getContext()->getServer();
$server = di(ServerManager::class)->getServer();
$server->sendMessage(swoole_unserialize($handler), $this->getWorker());
} catch (Throwable $exception) {
logger()->addError($exception);
@@ -92,7 +92,7 @@ class Zookeeper implements CustomProcess
private function getWorker(): int
{
if ($this->workerNum == 0) {
$server = ServerManager::getContext()->getServer();
$server = di(ServerManager::class)->getServer();
$this->workerNum = $server->setting['worker_num'] + ($server->setting['task_worker_num'] ?? 0);
}