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

   ## 🔄 Upstream Sync from Community Fork
   
   This PR automatically syncs changes from the community fork to the upstream 
repository.
   
   ### Original Contribution
   
   - **Author**: @Similarityoung
   - **Original PR**: https://github.com/dubbo-go-pixiu/dubbo-go-pixiu/pull/21
   - **Merged at**: 2025-11-02 13:36:20 UTC
   
   ### Original PR Description
   
   ---
   
   This pull request introduces thread-safety improvements for both the Nacos 
registry client test mocks and the MCP session management logic. The main 
changes involve adding mutexes to protect shared state, refactoring mock client 
usage to pointers, and updating tests to account for concurrent access. These 
updates help prevent race conditions and ensure correct behavior in concurrent 
scenarios.
   
   ## Summary by Sourcery
   
   Enhance thread safety in Nacos registry client mocks and MCP session 
management by adding synchronization and converting receivers to pointers
   
   Bug Fixes:
   - Prevent data races in MockedNacosConfigClient by protecting its listener 
map with a mutex
   - Fix race conditions in MCPSession.LastActivity updates within 
SessionManager and SSE handler by using mutexes
   
   Enhancements:
   - Convert MockedNacosConfigClient methods to pointer receivers and add 
sync.RWMutex to both mock client and MCPSession
   - Refactor tests to instantiate the mock client as a pointer and guard 
shared newConfig and LastActivity accesses with mutexes
   
   Tests:
   - Update client_test.go and session_manager_test.go to lock and unlock 
around shared state accesses to eliminate test races
   
   <!-- This is an auto-generated comment: release notes by coderabbit.ai -->
   
   ## Summary by CodeRabbit
   
   * **Refactor**
     * Strengthened internal concurrency controls with enhanced synchronization 
mechanisms for safer concurrent operations.
     * Updated component architecture and method signatures to properly support 
state management and thread-safety.
   
   * **Tests**
     * Improved test coverage for concurrent scenarios with enhanced 
synchronization validation.
   
   <!-- end of auto-generated comment: release notes by coderabbit.ai -->
   
   ---
   
   All commits preserve original authorship.
   
   **Note**: Auto-created when PR #21 was merged into 
`dubbo-go-pixiu/dubbo-go-pixiu:develop`.
   
   cc @Similarityoung
   


-- 
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