* pkg/tools/batcher: stop scheduler panicking when b.data is closed externally
scheduler()'s defer unconditionally calls close(b.data). If the channel
was closed by the caller (or an upstream producer) instead of via the
normal Close()-sends-nil path, the receive on b.data returns ok == false,
scheduler returns, and the deferred close(b.data) then fires on an
already-closed channel:
panic: close of closed channel
reliably reproducible under the #3653 steps (manually closing b.data
while Start() is running).
Track whether we observed the external-close via a local
`externallyClosed` flag set in the `ok == false` branch. The defer
only closes b.data when that flag is false, i.e. when the scheduler
exited through the nil-message or ticker paths and still owns the
channel. No behaviour change on the graceful Close() path.
Fixes#3653
* ci: retrigger after transient gha outage
Signed-off-by: SAY-5 <say.apm35@gmail.com>
---------
Signed-off-by: SAY-5 <say.apm35@gmail.com>
(cherry picked from commit b3a7342a42ca7daf3e01e275fb0e7d166fb16a58)
* refactor(group): optimize group notification and cache handling
- Improve notification sender with bulk operations and fallback logic
- Enhance group cache with new methods for member counts and version handling
- Refactor group controller with better cache integration
- Add more robust error handling and logging
fix(group): optimize group cache implementation
This commit refactors the GroupCacheRedis implementation to improve code organization and maintainability. The changes include:
- Added proper import organization and removed unused imports
- Implemented batchGetCache2 function calls for efficient data retrieval
- Added comprehensive cache key management functions
- Improved version tracking for group members and requests
- Enhanced error handling and logging
- Added batch operations for better performance
- Refactored complex functions into smaller, more manageable pieces
The changes focus on improving the overall structure and performance of the group cache system while maintaining backward compatibility.
refactor(group): improve notification error handling and add admin context
- Convert notification methods to return errors for better error propagation
- Add admin context checking for bulk notifications
- Enhance group info retrieval with proper error handling
- Improve notification sender with fallback user information
fix(group): handle nil group member map in notification
Add nil check for groupMemberMap[groupInfo.GroupID] before accessing to prevent nil pointer panic. Skip iteration if map is nil.
refactor(group): update group notification methods to use UserInfo struct
Renamed function parameter from groupMemberUserID string to changedUserInfo *sdkws.UserInfo
Updated function logic to use changedUserInfo.UserID instead of separate parameter
Refactored notification methods to use consistent UserInfo struct pattern
Added proper error handling for opUser retrieval
Updated function signatures and internal logic for GroupMemberInfoSetNotificationBulk
fix: batchGetGroupRoleLevelMemberIDs with BatchCache
fix: GetGroupMemberNums BatchCache
perf(group): optimize notification logic for group member operations
# Conflicts:
# internal/rpc/group/group.go
# pkg/common/storage/cache/redis/group.go
# Conflicts:
# internal/rpc/group/group.go
# pkg/common/storage/cache/redis/group.go
* fix: checkAdmin
* Fix: Resolved the issue of incorrect generation of conversationID in 3.8.3-patch branch.
* fix: solve incorrect time.Unix and logger asyncwrite in 3.8.3-patch branch.
* fix: incorrect redis fields.
* Fix: Resolved the issue of incorrect generation of conversationID in 3.8.3-patch branch.
* fix: solve incorrect time.Unix and logger asyncwrite in 3.8.3-patch branch.