This commit is contained in:
2023-07-31 23:08:58 +08:00
parent 2b2a779b94
commit ba3df62cb5
11 changed files with 70 additions and 137 deletions
+6 -7
View File
@@ -3,6 +3,7 @@
namespace Kiri\Server\Abstracts;
use Kiri\Abstracts\Logger;
use Kiri\Di\Context;
use Kiri\Server\Contract\OnProcessInterface;
use Swoole\Coroutine;
@@ -88,17 +89,15 @@ abstract class BaseProcess implements OnProcessInterface
abstract public function onSigterm(): static;
/**
* @param $data
* @throws \ReflectionException
*/
/**
* @param $data
* @return void
*/
protected function onShutdown($data): void
{
$this->isStop = true;
$value = Context::get('waite:process:message');
\Kiri::getLogger()->alert('Process ' . $this->getName() . ' stop');
Logger::_alert('Process ' . $this->getName() . ' stop');
if (!is_null($value) && Coroutine::exists((int)$value)) {
Coroutine::cancel((int)$value);
}