You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've noticed a potential bug in the SetUserStatus method within the user server logic. The method is supposed to handle both online and offline status updates for users, but it appears to incorrectly handle the offline status.
Current Behavior:
The method initializes online and offline slices to store platform IDs for online and offline statuses respectively.
However, regardless of whether the status is set to constant.Online or constant.Offline, the platform ID is only added to the online slice. This leads to a failure in correctly updating the offline status in the SetUserOnline method.
Expected Behavior:
The method should correctly assign the platform ID to either the online or offline slice based on the status provided in the request.
The offline slice should be populated when the status is constant.Offline, allowing the SetUserOnline method to accurately reflect the user's offline status in Redis.
Steps to Reproduce:
Call the SetUserStatus method with a status of constant.Offline.
Observe that the platform ID is added to the online slice instead of the offline slice.
Proposed Fix:
Update the switch case to correctly assign the platform ID to the offline slice when the status is constant.Offline.
It seems like a simple oversight, but it's crucial for the functionality of the user status management.
I've reviewed the related SetUserOnline method and confirmed that it relies on the correct assignment of platform IDs to the online and offline slices.
Thank you for considering this bug fix. I believe addressing this will improve the accuracy of user status updates in our system.
OpenIM Server Version
3.8.0
Operating System and CPU Architecture
Linux (AMD)
Deployment Method
Source Code Deployment
Bug Description and Steps to Reproduce
Description:
Hello,
I've noticed a potential bug in the
SetUserStatus
method within the user server logic. The method is supposed to handle both online and offline status updates for users, but it appears to incorrectly handle the offline status.Current Behavior:
online
andoffline
slices to store platform IDs for online and offline statuses respectively.constant.Online
orconstant.Offline
, the platform ID is only added to theonline
slice. This leads to a failure in correctly updating the offline status in theSetUserOnline
method.Expected Behavior:
online
oroffline
slice based on the status provided in the request.offline
slice should be populated when the status isconstant.Offline
, allowing theSetUserOnline
method to accurately reflect the user's offline status in Redis.Steps to Reproduce:
SetUserStatus
method with a status ofconstant.Offline
.online
slice instead of theoffline
slice.Proposed Fix:
offline
slice when the status isconstant.Offline
.Additional Information:
SetUserOnline
method and confirmed that it relies on the correct assignment of platform IDs to theonline
andoffline
slices.Thank you for considering this bug fix. I believe addressing this will improve the accuracy of user status updates in our system.
Screenshots Link
func (s *userServer) SetUserStatus:
https://github.com/openimsdk/open-im-server/blob/v3.8.0/internal/rpc/user/online.go#L53
The text was updated successfully, but these errors were encountered: