Skip to content

Commit

Permalink
Merge pull request #1681 from replicatedhq/divolgin/logout
Browse files Browse the repository at this point in the history
fix deadlock in logout handler
  • Loading branch information
divolgin committed Mar 29, 2021
2 parents ce6f8ae + 9908b4a commit 33329bd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/store/kotsstore/session_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,16 +173,17 @@ func (s *KOTSStore) GetSession(id string) (*sessiontypes.Session, error) {

func (s *KOTSStore) DeleteSession(id string) error {
sessionLock.Lock()
defer sessionLock.Unlock()

s.sessionSecret = nil
sessionLock.Unlock()

secret, err := s.getSessionSecret()
if err != nil {
return errors.Wrap(err, "failed to get session secret")
}

sessionLock.Lock()
delete(secret.Data, id)
sessionLock.Unlock()

if err := s.updateSessionSecret(secret); err != nil {
return errors.Wrap(err, "failed to update session secret")
Expand Down

0 comments on commit 33329bd

Please sign in to comment.