1
This commit is contained in:
parent
a82677e4df
commit
7f38d722b4
@ -26,6 +26,8 @@ func CaForward(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
cLock := service.SApiForward.AcquireLock(accountId)
|
||||
defer service.SApiForward.ReleaseLock(cLock)
|
||||
service.SApiForward.IncTotalTimes()
|
||||
beginTick := q5.GetTickCount()
|
||||
defer func() {
|
||||
|
@ -90,12 +90,13 @@ func (this *sApiForward) UpdateCostTime(costTime int64) {
|
||||
|
||||
func (this *sApiForward) getOrCreate(c *SApiForwardLockCache, accountId string) *SApiForwardLock {
|
||||
c.lock.Lock()
|
||||
defer c.lock.Lock()
|
||||
defer c.lock.Unlock()
|
||||
if u, ok := (*c.userHash)[accountId]; ok {
|
||||
return u
|
||||
} else {
|
||||
u = new(SApiForwardLock)
|
||||
u.accountId = accountId
|
||||
u.lock = new(sync.Mutex)
|
||||
return u
|
||||
}
|
||||
}
|
||||
|
@ -4,9 +4,10 @@ type serviceMgr struct {
|
||||
}
|
||||
|
||||
func (this *serviceMgr) Init() {
|
||||
|
||||
SApiForward = new(sApiForward)
|
||||
SApiForward.init()
|
||||
}
|
||||
|
||||
func (this *serviceMgr) UnInit() {
|
||||
|
||||
SApiForward.unInit()
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user