Skip to content

Commit

Permalink
rpc: don't error on missing session if closeSession
Browse files Browse the repository at this point in the history
  • Loading branch information
patrislav committed May 21, 2024
1 parent 118033a commit a691604
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion rpc/intents.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func (s *RPC) SendIntent(ctx context.Context, protoIntent *proto.Intent) (*proto
defer span.End()

sess, found, err := s.Sessions.Get(ctx, tntData.ProjectID, sessionID)
if err != nil || !found {
if (err != nil || !found) && intent.Name != intents.IntentName_closeSession {
return nil, fmt.Errorf("session invalid or not found")
}

Expand Down
2 changes: 1 addition & 1 deletion rpc/sessions.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func (s *RPC) dropSession(
tntData := tenant.FromContext(ctx)

dropSess, found, err := s.Sessions.Get(ctx, tntData.ProjectID, intent.Data.SessionID)
if err != nil || !found || dropSess.UserID != sess.UserID {
if err != nil || !found || sess == nil || dropSess.UserID != sess.UserID {
return true, nil
}

Expand Down

0 comments on commit a691604

Please sign in to comment.