-
Notifications
You must be signed in to change notification settings - Fork 296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: optimize implement of the sync peers #3677
Conversation
8a1941e
to
0a2873b
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3677 +/- ##
==========================================
- Coverage 35.50% 35.45% -0.05%
==========================================
Files 336 335 -1
Lines 37657 37617 -40
==========================================
- Hits 13369 13337 -32
+ Misses 23461 23457 -4
+ Partials 827 823 -4
Flags with carried forward coverage won't be shown. Click here to find out more.
|
0a2873b
to
b809422
Compare
0b273ad
to
1a855da
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
af40d1a
to
3a0ba1f
Compare
Signed-off-by: Gaius <gaius.qi@gmail.com>
3a0ba1f
to
da3184a
Compare
Description
This pull request includes significant changes to the synchronization of peer information in the
manager
package, specifically focusing on improving the sync process and validation. The most important changes include updating the peer sync logic, adding validation for theBatchSize
parameter, and modifying related tests.Improvements to peer synchronization:
manager/job/sync_peers.go
: Refactored theSyncPeers
interface and related methods to make the sync operation synchronous, ensuring no concurrent sync jobs run simultaneously. The new logic merges sync peer results with the database and handles batch operations more efficiently. [1] [2] [3]Validation enhancements:
manager/config/config.go
: Added validation to ensureBatchSize
is not zero in theValidate
method and updated theSyncPeersConfig
struct to clarify the purpose of theBatchSize
field. [1] [2]Test updates:
manager/config/config_test.go
: Updated tests to include validation for theBatchSize
parameter and ensure proper configuration loading. [1] [2]Configuration updates:
manager/config/constants.go
: Updated the description of the default batch size constant to reflect its dual purpose for syncing peers and database operations.manager/config/testdata/manager.yaml
: Added thebatchSize
parameter to thesyncPeers
configuration in the test data.These changes enhance the robustness and efficiency of the peer synchronization process and ensure proper configuration validation.
Related Issue
Motivation and Context
Screenshots (if appropriate)
Types of changes
Checklist