Skip to content

Commit

Permalink
Fixed bug that configuration of other processes were not updated when…
Browse files Browse the repository at this point in the history
… using `nacos grpc client` (#6110)
  • Loading branch information
her-cat committed Aug 31, 2023
1 parent f7297f0 commit 3425f00
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-3.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- [#6097](https://github.com/hyperf/hyperf/pull/6097) Fixed error that using non-zipkin driver of tracer.
- [#6099](https://github.com/hyperf/hyperf/pull/6099) Fixed bug that `ConstantFrequency` cannot work when using `redis`.
- [#6110](https://github.com/hyperf/hyperf/pull/6110) Fixed bug that configuration of other processes were not updated when using `nacos grpc client`.

## Added

Expand Down
12 changes: 9 additions & 3 deletions src/config-nacos/src/NacosDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,15 @@ public function createMessageFetcherLoop(): void

$client = $application->grpc->get($tenant);
$client->listenConfig($group, $dataId, new ConfigChangeNotifyRequestHandler(function (ConfigQueryResponse $response) use ($key, $type) {
$this->updateConfig([
$key => $this->client->decode($response->getContent(), $type),
]);
$config = $this->client->decode($response->getContent(), $type);
$prevConfig = $this->config->get($key, []);

if ($config !== $prevConfig) {
$this->syncConfig(
[$key => $config],
[$key => $prevConfig],
);
}
}));
}

Expand Down

0 comments on commit 3425f00

Please sign in to comment.