改名
This commit is contained in:
@@ -18,8 +18,7 @@ class OnStart extends Callback
|
||||
*/
|
||||
public function onHandler($server)
|
||||
{
|
||||
$time = storage('socket.sock');
|
||||
Snowflake::writeFile($time, $server->master_pid);
|
||||
Snowflake::setProcessId($server->master_pid);
|
||||
|
||||
$event = Snowflake::app()->event;
|
||||
if ($event->exists(Event::SERVER_EVENT_START)) {
|
||||
|
||||
@@ -31,7 +31,7 @@ class OnWorkerStart extends Callback
|
||||
*/
|
||||
public function onHandler(Server $server, $worker_id)
|
||||
{
|
||||
Snowflake::setProcessId($server->worker_pid);
|
||||
Snowflake::setWorkerId($server->worker_pid);
|
||||
|
||||
$get_name = $this->get_process_name($server, $worker_id);
|
||||
if (!empty($get_name) && !Snowflake::isMac()) {
|
||||
|
||||
@@ -130,6 +130,17 @@ class Snowflake
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $workerId
|
||||
* @return false|int|mixed
|
||||
* @throws Exception
|
||||
*/
|
||||
public static function setWorkerId($workerId)
|
||||
{
|
||||
return self::writeFile(storage($workerId . '.sock', 'worker'), $workerId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param $fileName
|
||||
* @param $content
|
||||
|
||||
Reference in New Issue
Block a user