mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-11-30 18:57:51 +08:00
Fixed bug.
This commit is contained in:
parent
30b182db92
commit
5d29105f39
@ -82,12 +82,7 @@ class ConfigFetcherProcess extends AbstractProcess
|
||||
$processes = ProcessCollector::all();
|
||||
/** @var \Swoole\Process $process */
|
||||
foreach ($processes as $process) {
|
||||
// TODO: Socket is not work for expected.
|
||||
/* @var \Swoole\Coroutine\Socket $sock */
|
||||
// $sock = $this->process->exportSocket();
|
||||
// $sock->send($string);
|
||||
|
||||
$process->write($string);
|
||||
$process->exportSocket()->send($string);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -105,22 +105,21 @@ abstract class AbstractProcess implements ProcessInterface
|
||||
*/
|
||||
protected function listen()
|
||||
{
|
||||
Event::add($this->process->pipe, function ($pipe) {
|
||||
try {
|
||||
// TODO: Socket is not work for expected.
|
||||
/** @var \Swoole\Coroutine\Socket $sock */
|
||||
// $sock = $this->process->exportSocket();
|
||||
// $recv = $sock->recv();
|
||||
|
||||
$recv = $this->process->read();
|
||||
if ($this->event && $data = unserialize($recv)) {
|
||||
$this->event->dispatch(new PipeMessage($data));
|
||||
}
|
||||
} catch (\Throwable $exception) {
|
||||
if ($this->container->has(StdoutLoggerInterface::class) && $this->container->has(FormatterInterface::class)) {
|
||||
$logger = $this->container->get(StdoutLoggerInterface::class);
|
||||
$formatter = $this->container->get(FormatterInterface::class);
|
||||
$logger->error($formatter->format($exception));
|
||||
go(function () {
|
||||
while (true) {
|
||||
try {
|
||||
/** @var \Swoole\Coroutine\Socket $sock */
|
||||
$sock = $this->process->exportSocket();
|
||||
$recv = $sock->recv();
|
||||
if ($this->event && $data = unserialize($recv)) {
|
||||
$this->event->dispatch(new PipeMessage($data));
|
||||
}
|
||||
} catch (\Throwable $exception) {
|
||||
if ($this->container->has(StdoutLoggerInterface::class) && $this->container->has(FormatterInterface::class)) {
|
||||
$logger = $this->container->get(StdoutLoggerInterface::class);
|
||||
$formatter = $this->container->get(FormatterInterface::class);
|
||||
$logger->error($formatter->format($exception));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user