改名
This commit is contained in:
@@ -9,6 +9,7 @@ use JetBrains\PhpStorm\Pure;
|
||||
use Server\SInterface\CustomProcess;
|
||||
use Kiri\Kiri;
|
||||
use Swoole\Timer;
|
||||
use Swoole\Process;
|
||||
|
||||
/**
|
||||
* Class Biomonitoring
|
||||
@@ -19,10 +20,10 @@ class Biomonitoring implements CustomProcess
|
||||
|
||||
|
||||
/**
|
||||
* @param \Swoole\Process $process
|
||||
* @param Process $process
|
||||
* @return string
|
||||
*/
|
||||
#[Pure] public function getProcessName(\Swoole\Process $process): string
|
||||
#[Pure] public function getProcessName(Process $process): string
|
||||
{
|
||||
// TODO: Implement getProcessName() method.
|
||||
return get_called_class();
|
||||
@@ -30,10 +31,10 @@ class Biomonitoring implements CustomProcess
|
||||
|
||||
|
||||
/**
|
||||
* @param \Swoole\Process $process
|
||||
* @param Process $process
|
||||
* @throws Exception
|
||||
*/
|
||||
public function onHandler(\Swoole\Process $process): void
|
||||
public function onHandler(Process $process): void
|
||||
{
|
||||
$server = Kiri::app()->getSwoole();
|
||||
Timer::tick(1000, function () use ($server) {
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
namespace Kiri\Process;
|
||||
|
||||
|
||||
use Exception;
|
||||
use JetBrains\PhpStorm\Pure;
|
||||
use Kiri\Event;
|
||||
use Kiri\Kiri;
|
||||
|
||||
/**
|
||||
* Class Process
|
||||
* @package Kiri\Kiri\Service
|
||||
*/
|
||||
abstract class Process extends \Swoole\Process implements SProcess
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* Process constructor.
|
||||
* @param $application
|
||||
* @param $name
|
||||
* @param bool $enable_coroutine
|
||||
* @throws Exception
|
||||
*/
|
||||
public function __construct($application, $name, $enable_coroutine = true)
|
||||
{
|
||||
parent::__construct([$this, '_load'], false, 1, $enable_coroutine);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Process $process
|
||||
* @throws Exception
|
||||
*/
|
||||
public function _load(Process $process)
|
||||
{
|
||||
Kiri::setProcessId($this->pid);
|
||||
|
||||
putenv('environmental=' . Kiri::PROCESS);
|
||||
|
||||
fire(Event::SERVER_WORKER_START);
|
||||
if (Kiri::getPlatform()->isLinux()) {
|
||||
name($this->pid, $this->getProcessName());
|
||||
}
|
||||
if (method_exists($this, 'before')) {
|
||||
$this->before($process);
|
||||
}
|
||||
$this->onHandler($process);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
#[Pure] private function getPrefix(): string
|
||||
{
|
||||
return static::class;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user