From 82539bbaaf78b8f6d82c554e13aaec242218e897 Mon Sep 17 00:00:00 2001 From: sunsgne <51745500+sunsgneayo@users.noreply.github.com> Date: Fri, 24 Nov 2023 15:41:59 +0800 Subject: [PATCH] Update AsyncConfigListenerProcess.php MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit bugfix:读取配置异常时依然执行空文本写入 --- src/Process/AsyncConfigListenerProcess.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Process/AsyncConfigListenerProcess.php b/src/Process/AsyncConfigListenerProcess.php index b9f2b68..4390153 100644 --- a/src/Process/AsyncConfigListenerProcess.php +++ b/src/Process/AsyncConfigListenerProcess.php @@ -51,6 +51,13 @@ public function __construct() protected function _get(string $dataId, string $group, string $tenant, string $path) { $res = $this->client->config->get($dataId, $group, $tenant); + if (false === $res){ + $this->logger()->error( + "Nacos listener failed: [1] {$this->client->config->getMessage()}.", + ['dataId' => $dataId, 'trace' => []] + ); + return; + } if(file_put_contents($path, $res, LOCK_EX)){ reload($path); } @@ -118,4 +125,4 @@ public function onWorkerStop(Worker $worker){ } } } -} \ No newline at end of file +}