Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions management/server/grpcserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -937,6 +937,12 @@ func (s *GRPCServer) Logout(ctx context.Context, req *proto.EncryptedMessage) (*
userID = activity.SystemInitiator
}

// if peer is ephemeral, we need to set it to false to prevent adding it to ephemeral deletion queue
if peer.Ephemeral {
peer.Ephemeral = false
}
s.cancelPeerRoutines(ctx, peer.AccountID, peer)
Comment on lines +940 to +944
Copy link
Preview

Copilot AI Aug 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The call to cancelPeerRoutines appears to be moved from its original location. Verify that this placement is correct and that the peer state modifications (setting Ephemeral to false) don't interfere with the routine cancellation logic.

Suggested change
// if peer is ephemeral, we need to set it to false to prevent adding it to ephemeral deletion queue
if peer.Ephemeral {
peer.Ephemeral = false
}
s.cancelPeerRoutines(ctx, peer.AccountID, peer)
// cancel peer routines before modifying peer state
s.cancelPeerRoutines(ctx, peer.AccountID, peer)
// if peer is ephemeral, we need to set it to false to prevent adding it to ephemeral deletion queue
if peer.Ephemeral {
peer.Ephemeral = false
}

Copilot uses AI. Check for mistakes.


if err = s.accountManager.DeletePeer(ctx, peer.AccountID, peer.ID, userID); err != nil {
log.WithContext(ctx).Errorf("failed to logout peer %s: %v", peerKey.String(), err)
return nil, mapError(ctx, err)
Expand Down
Loading