update active session if none is found

master
Up 2024-05-15 06:46:08 +02:00
parent 76e7ba02ad
commit c17c583321
No known key found for this signature in database
GPG Key ID: 3B75CD7439FEB388
1 changed files with 5 additions and 8 deletions

View File

@ -215,17 +215,14 @@ func IsActiveSession(uuid []byte, clientSessionId string) (bool, error) {
err := handle.QueryRow("SELECT clientSessionId FROM activeClientSessions WHERE uuid = ?", uuid).Scan(&storedId) err := handle.QueryRow("SELECT clientSessionId FROM activeClientSessions WHERE uuid = ?", uuid).Scan(&storedId)
if err != nil { if err != nil {
if errors.Is(err, sql.ErrNoRows) { if errors.Is(err, sql.ErrNoRows) {
return false, nil
}
return false, err
}
if storedId == "" {
err = UpdateActiveSession(uuid, clientSessionId) err = UpdateActiveSession(uuid, clientSessionId)
if err != nil { if err != nil {
return false, err return false, err
} }
return true, nil return true, nil
} }
return false, err
}
return storedId == clientSessionId, nil return storedId == clientSessionId, nil
} }