Merge branch 'dev' into market

This commit is contained in:
yangduo 2024-08-07 10:41:41 +08:00
commit f3489c2593

View File

@ -62,7 +62,11 @@ func (this *sApiForward) AcquireLock(accountId string) *SApiForwardLock {
func (this *sApiForward) ReleaseLock(l *SApiForwardLock) { func (this *sApiForward) ReleaseLock(l *SApiForwardLock) {
l.lock.Unlock() l.lock.Unlock()
atomic.AddInt32(&l.lockTimes, -1) if atomic.AddInt32(&l.lockTimes, -1) < 1 {
crc32 := q5.Crc32(l.accountId)
c := this.userCache[int64(crc32)%int64(len(this.userCache))]
delete(*c.userHash, l.accountId)
}
} }
func (this *sApiForward) IncInvalidSessionTimes() { func (this *sApiForward) IncInvalidSessionTimes() {
@ -119,6 +123,7 @@ func (this *sApiForward) getOrCreate(c *SApiForwardLockCache, accountId string)
u = new(SApiForwardLock) u = new(SApiForwardLock)
u.accountId = accountId u.accountId = accountId
u.lock = new(sync.Mutex) u.lock = new(sync.Mutex)
(*c.userHash)[accountId] = u
return u return u
} }
} }