From 90dbe5257c7a1162bd8da41d3971d19d616c0504 Mon Sep 17 00:00:00 2001 From: Deeka Wong Date: Fri, 15 Mar 2024 17:31:48 +0800 Subject: [PATCH] Optimized the worker process to no longer output warn information after exiting (#6600) --- src/AMQPConnection.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/AMQPConnection.php b/src/AMQPConnection.php index 9bf7bc3..d6ad087 100644 --- a/src/AMQPConnection.php +++ b/src/AMQPConnection.php @@ -171,13 +171,17 @@ public function releaseChannel(AMQPChannel $channel, bool $confirm = false): voi public function close($reply_code = 0, $reply_text = '', $method_sig = [0, 0]) { try { - $res = parent::close($reply_code, $reply_text, $method_sig); + return parent::close($reply_code, $reply_text, $method_sig); + } catch (Throwable $e) { + if (! $this->exited) { + throw $e; + } } finally { $this->setIsConnected(false); $this->chan->close(); $this->channelManager->flush(); } - return $res; + return null; } protected function makeChannelId(): int @@ -297,7 +301,7 @@ protected function heartbeat(): void $this->chan->push($pkt->getvalue(), 0.001); } } catch (Throwable $exception) { - $this->logger && $this->logger->error((string) $exception); + $this->logger?->error((string) $exception); } } });