This commit is contained in:
aozhiwei 2024-05-25 11:48:51 +08:00
parent 7b77926b4b
commit 4196be22f3

View File

@ -10,7 +10,7 @@ import (
type userSession struct { type userSession struct {
accountId string accountId string
sessionId string sessionId string
lastUpdateTick int64 lastUpdateTime int64
} }
type sessionMgr struct { type sessionMgr struct {
@ -37,13 +37,13 @@ func (this *sessionMgr) UnInit() {
func (this *sessionMgr) UpdateSession(accountId string, sessionId string) { func (this *sessionMgr) UpdateSession(accountId string, sessionId string) {
session := this.getSession(accountId) session := this.getSession(accountId)
if session != nil { if session != nil {
session.lastUpdateTick = q5.GetTickCount() session.lastUpdateTime = f5.GetApp().GetRealSeconds()
return return
} }
this.lock.Lock() this.lock.Lock()
session = this.getSession(accountId) session = this.getSession(accountId)
if session != nil { if session != nil {
session.lastUpdateTick = q5.GetTickCount() session.lastUpdateTime = f5.GetApp().GetRealSeconds()
this.lock.Unlock() this.lock.Unlock()
return return
} }
@ -51,7 +51,7 @@ func (this *sessionMgr) UpdateSession(accountId string, sessionId string) {
session = new(userSession) session = new(userSession)
session.accountId = accountId session.accountId = accountId
session.sessionId = sessionId session.sessionId = sessionId
session.lastUpdateTick = q5.GetTickCount() session.lastUpdateTime = f5.GetApp().GetRealSeconds()
this.idHash.Store(accountId, session) this.idHash.Store(accountId, session)
this.lock.Unlock() this.lock.Unlock()
} }