This commit is contained in:
2021-07-23 11:55:02 +08:00
parent 4fbbfb37e4
commit 93519c3c57
4 changed files with 15 additions and 14 deletions
+5 -4
View File
@@ -62,10 +62,11 @@ class Kafka implements CustomProcess
}
/**
* @param array $kafkaServer
* @throws \Exception
*/
/**
* @param Process $process
* @param array $kafkaServer
* @throws \Exception
*/
private function waite(Process $process, array $kafkaServer)
{
try {
+5 -5
View File
@@ -42,7 +42,7 @@ class Producer extends Component
* @param array $config
* @throws Exception
*/
public function __construct($config = [])
public function __construct(array $config = [])
{
parent::__construct($config);
if (!class_exists(Conf::class)) {
@@ -56,10 +56,10 @@ class Producer extends Component
}
/**
* @param $servers
* @return Producer
*/
/**
* @param string $servers
* @return Producer
*/
public function setBrokers(string $servers): static
{
$this->conf->set('metadata.broker.list', $servers);
+3 -3
View File
@@ -122,7 +122,7 @@ class ServerManager extends Abstracts\Server
if (Snowflake::getPlatform()->isLinux()) {
$soloProcess->name($system . '.' . $customProcess->getProcessName($soloProcess) . ' start.');
}
echo sprintf("\033[36m[init]\033[0m Process %s start.", $customProcess->getProcessName($soloProcess)) . PHP_EOL;
echo sprintf("\033[36m[" . date('Y-m-d H:i:s') . "]\033[0m Process %s start.", $customProcess->getProcessName($soloProcess)) . PHP_EOL;
$customProcess->onHandler($soloProcess);
},
$redirect_stdin_and_stdout, $pipe_type, $enable_coroutine));
@@ -213,7 +213,7 @@ class ServerManager extends Abstracts\Server
*/
private function addNewListener(string $type, string $host, int $port, int $mode, array $settings = [])
{
echo sprintf("\033[36m[init]\033[0m $type service %s::%d start.", $host, $port) . PHP_EOL;
echo sprintf("\033[36m[" . date('Y-m-d H:i:s') . "]\033[0m $type service %s::%d start.", $host, $port) . PHP_EOL;
switch ($type) {
case Constant::SERVER_TYPE_TCP:
$this->ports[$port] = TCPServerListener::instance($this->server, $host, $port, $mode, $settings);
@@ -271,7 +271,7 @@ class ServerManager extends Abstracts\Server
$settings['settings']
));
echo sprintf("\033[36m[init]\033[0m $type service %s::%d start.", $host, $port) . PHP_EOL;
echo sprintf("\033[36m[" . date('Y-m-d H:i:s') . "]\033[0m $type service %s::%d start.", $host, $port) . PHP_EOL;
$this->addDefaultListener($type, $settings);
}
+2 -2
View File
@@ -53,13 +53,13 @@ class ServerWorker extends \Server\Abstracts\Server
$loader = Snowflake::app()->getRouter();
$loader->_loader();
echo sprintf("\033[36m[init]\033[0m Worker[%d].%d start.", $server->worker_pid, $workerId) . PHP_EOL;
echo sprintf("\033[36m[" . date('Y-m-d H:i:s') . "]\033[0m Worker[%d].%d start.", $server->worker_pid, $workerId) . PHP_EOL;
$this->setProcessName(sprintf('Worker[%d].%d', $workerId, $server->worker_pid));
$annotation->runtime(CONTROLLER_PATH);
$annotation->runtime(MODEL_PATH);
} else {
echo sprintf("\033[36m[init]\033[0m Tasker[%d].%d start.", $server->worker_pid, $workerId) . PHP_EOL;
echo sprintf("\033[36m[" . date('Y-m-d H:i:s') . "]\033[0m Tasker[%d].%d start.", $server->worker_pid, $workerId) . PHP_EOL;
$this->setProcessName(sprintf('Tasker[%d].%d', $workerId, $server->worker_pid));