Skip to content

Commit 3bf0af1

Browse files
authored
fix(session): Fixed the session status update logic. (#9296)
- Removed the error returned when the session status is `SessionInactive`. - Updated the `LastActive` field of the session to always record the current time.
1 parent de09ba0 commit 3bf0af1

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

internal/device/session.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,9 @@ func Handle(userID uint, deviceKey, ua, ip string) error {
2525
now := time.Now().Unix()
2626
sess, err := db.GetSession(userID, deviceKey)
2727
if err == nil {
28-
if sess.Status == model.SessionInactive {
29-
return errors.WithStack(errs.SessionInactive)
30-
}
31-
sess.LastActive = now
28+
// reactivate existing session if it was inactive
3229
sess.Status = model.SessionActive
30+
sess.LastActive = now
3331
sess.UserAgent = ua
3432
sess.IP = ip
3533
return db.UpsertSession(sess)

0 commit comments

Comments
 (0)