-
-
Notifications
You must be signed in to change notification settings - Fork 1
Add DHT mode and cleanup interval configuration #8
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Extract common test setup into createTestClient helper function - Consolidate overlapping tests (TestDHTModeDefault, TestDHTModeServer, TestDHTModeClient) into TestDHTModeSelection - Merge TestDHTModeServerWithVariousCleanupIntervals into TestDHTCleanupIntervalConfiguration - Reduce test count from 11 to 5 while maintaining full coverage - Use t.Helper() and t.Cleanup() for better test organization - Add descriptive assertion messages for clearer failures - Improve benchmark error handling Changes: - Lines of code reduced: 416 -> 312 (25% reduction) - Tests consolidated: 11 -> 5 (same coverage, better organization) - Code duplication eliminated: 9 repeated log setups, 11 repeated client creations now use 1 helper - All tests still pass with identical coverage
2755235 to
bb01e1a
Compare
…go-p2p-message-bus into feature/dht-mode-cleanup # Conflicts: # dht_config_test.go
mrz1836
approved these changes
Nov 4, 2025
Contributor
mrz1836
left a comment
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
Collaborator
|
Could not enable auto-merge: Command failed: gh pr merge --auto --squash --delete-branch "#8" This might be due to:
|
Added Go modules configuration for the /example/ directory to ensure weekly updates for direct dependencies, including security patterns and commit message prefixing.
Updated dependencies to their latest versions for improved stability and performance.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.



Summary
Adds configurable DHT mode (client/server) and cleanup interval to optimize CPU usage in DHT provider record management.
Changes
Configuration Options
Implementation Details
DHTModeandDHTCleanupIntervalfields toConfigstructsetupDHT()to support mode selection and custom ProviderManagerP2PClienttype alias for backward compatibilityTest Coverage
All tests pass ✅
Performance Impact
CPU Usage Reduction
With custom cleanup interval (e.g., 24 hours):
Use Cases
Backward Compatibility
P2PClienttype alias to maintain compatibility with existing codeRelated Issues
Addresses high CPU usage in DHT ProviderManager cleanup as identified in production profiling.