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