改名
This commit is contained in:
@@ -13,8 +13,7 @@ use Snowflake\Snowflake;
|
||||
trait Server
|
||||
{
|
||||
|
||||
/** @var Application */
|
||||
public $application;
|
||||
public ?Application $application = null;
|
||||
|
||||
|
||||
/**
|
||||
@@ -26,7 +25,6 @@ trait Server
|
||||
*/
|
||||
public function __construct($host, $port = null, $mode = null, $sock_type = null)
|
||||
{
|
||||
$this->application = Snowflake::app();
|
||||
parent::__construct($host, $port, $mode, $sock_type);
|
||||
}
|
||||
|
||||
|
||||
+5
-5
@@ -86,11 +86,11 @@ class Kafka extends \Snowflake\Process\Process
|
||||
if ($message->err == RD_KAFKA_RESP_ERR_NO_ERROR) {
|
||||
$this->handlerExecute($message->topic_name, $message);
|
||||
} else if ($message->err == RD_KAFKA_RESP_ERR__PARTITION_EOF) {
|
||||
$this->application->warning('No more messages; will wait for more');
|
||||
logger()->warning('No more messages; will wait for more');
|
||||
} else if ($message->err == RD_KAFKA_RESP_ERR__TIMED_OUT) {
|
||||
$this->application->error('Kafka Timed out');
|
||||
logger()->error('Kafka Timed out');
|
||||
} else {
|
||||
$this->application->error($message->errstr());
|
||||
logger()->error($message->errstr());
|
||||
}
|
||||
} catch (Throwable $exception) {
|
||||
logger()->addError($exception, 'throwable');
|
||||
@@ -142,8 +142,8 @@ class Kafka extends \Snowflake\Process\Process
|
||||
$conf->set('metadata.broker.list', $kafka['brokers']);
|
||||
$conf->set('socket.timeout.ms', '30000');
|
||||
|
||||
$this->application->debug('kafka listen groupId ' . $kafka['groupId']);
|
||||
$this->application->debug('kafka listen brokers ' . $kafka['brokers']);
|
||||
logger()->debug('kafka listen groupId ' . $kafka['groupId']);
|
||||
logger()->debug('kafka listen brokers ' . $kafka['brokers']);
|
||||
|
||||
if (function_exists('pcntl_sigprocmask')) {
|
||||
pcntl_sigprocmask(SIG_BLOCK, array(SIGIO));
|
||||
|
||||
@@ -34,7 +34,6 @@ abstract class Process extends \Swoole\Process implements SProcess
|
||||
public function __construct($application, $name, $enable_coroutine = true)
|
||||
{
|
||||
parent::__construct([$this, '_load'], false, 1, $enable_coroutine);
|
||||
$this->application = $application;
|
||||
Snowflake::setProcessId($this->pid);
|
||||
}
|
||||
|
||||
|
||||
@@ -265,8 +265,8 @@ class ServerInotify extends Process
|
||||
if (str_contains($message, 'The file descriptor is not an inotify instance')) {
|
||||
return;
|
||||
}
|
||||
$this->application->debug('Error:' . $message);
|
||||
$this->application->debug($file . ':' . $line);
|
||||
logger()->debug('Error:' . $message);
|
||||
logger()->debug($file . ':' . $line);
|
||||
}
|
||||
|
||||
|
||||
@@ -279,7 +279,7 @@ class ServerInotify extends Process
|
||||
{
|
||||
//目录不存在
|
||||
if (!is_dir($dir)) {
|
||||
return $this->application->addError("[$dir] is not a directory.");
|
||||
return logger()->addError("[$dir] is not a directory.");
|
||||
}
|
||||
//避免重复监听
|
||||
if (isset($this->watchFiles[$dir])) {
|
||||
|
||||
Reference in New Issue
Block a user