mutezebra opened a new pull request, #647:
URL: https://github.com/apache/dubbo-go-pixiu/pull/647

   <!--  Thanks for sending a pull request! 
   -->
   
   **What this PR does**:
   
   **Which issue(s) this PR fixes**:
   <!--
   *Automatically closes linked issue when PR is merged.
   Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
   _If PR is about `failing-tests or flakes`, please post the related 
issues/tests in a comment and do not use `Fixes`_*
   -->
   Fixes #
   
   **Special notes for your reviewer**:
   # The following is the content of this PR
   
   
   ## ConfigCenter Listening
   
   Implemented the ConfigCenter's ability to listen for configuration file 
changes and configured the `onChange` function to trigger hot updates. This 
process ensures concurrency safety, as consistency must be maintained when 
requesting `remoteConfig` while the configuration file might be changing 
simultaneously.
   
   ## ConfigManager in `pkg/config` Now Supports Viewing Remote Config
   
   Added a `ViewConfig` method to the `load` interface within the original 
`ConfigManager` (referred to as `cm`). This allows `cm` to access the remote 
configuration from ConfigCenter. Additionally, a function with the same name 
was added to expose the latest ConfigCenter configuration externally.
   
   ## HotReload
   
   Defined the foundational structure for `HotReload` and implemented 
concurrency-safe hot updates for the logger module.
   
   This process is achieved through a scheduled task that periodically requests 
the latest ConfigCenter configuration from `cm`. It then checks if the 
configuration file has been updated and triggers a hot update if changes are 
detected. It is important to note that `ConfigManager` does not have the 
capability to detect configuration changes, so I did not modify the internal 
variables of `ConfigManager`. Instead, `ConfigManager` acts as an intermediary 
to provide access to ConfigCenter's configuration. This ensures that existing 
modules relying on `ConfigManager` or configuration files remain unaffected. 
Currently, changes to ConfigCenter configurations only impact the `HotReload` 
module.
   
   ## Testing
   
   Wrote comprehensive unit tests to ensure the correctness of the 
functionality. During local testing of the compiled `pixiu`, I encountered a 
dependency issue: the original `pkg/config` used **"github.com/ghodss/yaml"**, 
which is based on **"gopkg.in/yaml.v2"**. This implementation failed to parse 
certain parameters in YAML files (e.g., a list with mixed types, such as 
`pkg/model/bootstrap.go Bootstrap.Nacos.ServerConfigs`). Additionally, the 
library is no longer actively maintained. After researching, I found that 
**"gopkg.in/yaml.v3"** resolves this issue and is compatible with our project's 
usage of related functions. As a result, I updated all relevant dependencies.
   
   ## Document
   
   Added **config_with_nacos.yaml** to the `configs` directory to provide a 
template for using ConfigCenter. Previously, the functionality existed but was 
not documented.
   
   **Does this PR introduce a user-facing change?**:
   <!--
   If no, just write "NONE" in the release-note block below.
   If yes, a release note is required:
   Enter your extended release note in the block below. If the PR requires 
additional action from users switching to the new release, include the string 
"action required".
   -->
   ```release-note
   NONE
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to