This commit is contained in:
2020-09-07 17:31:01 +08:00
parent c6215a8c38
commit 69a1f7cad5
2 changed files with 25 additions and 11 deletions
+23 -1
View File
@@ -7,6 +7,7 @@ namespace Snowflake\Process;
use Snowflake\Abstracts\Component;
use Snowflake\Application;
use Snowflake\Exception\ComponentException;
use Snowflake\Snowflake;
use Swoole\Coroutine\Socket;
use Swoole\Process\Pool;
@@ -14,7 +15,28 @@ use Swoole\Process\Pool;
* Class Process
* @package Snowflake\Snowflake\Service
*/
abstract class Process extends Component
abstract class Process extends \Swoole\Process
{
/** @var Application $application */
protected $application;
/**
* Process constructor.
* @param $application
* @param $name
* @throws \Exception
*/
public function __construct($application, $name)
{
parent::__construct([$this, 'onHandler'], false, 1, true);
$this->application = $application;
if (Snowflake::isLinux()) {
$this->name($name);
}
Snowflake::setWorkerId($this->pid);
}
}