1
This commit is contained in:
parent
9790bfdd6e
commit
73e720ae91
@ -79,12 +79,14 @@ func (this *HttpServer) dispatchRequest(c *Context) {
|
||||
handle := this.getHandle(handleName)
|
||||
if handle != nil {
|
||||
beginTick := q5.GetTickCount()
|
||||
defer func() {
|
||||
endTick := q5.GetTickCount()
|
||||
if oldVal := atomic.LoadInt64(&this.maxHandleTime); beginTick - endTick > oldVal {
|
||||
atomic.CompareAndSwapInt64(&this.maxHandleTime, oldVal, endTick - beginTick)
|
||||
}
|
||||
atomic.AddInt64(&this.okTimes, 1)
|
||||
}()
|
||||
handle(c)
|
||||
endTick := q5.GetTickCount()
|
||||
if oldVal := atomic.LoadInt64(&this.maxHandleTime); beginTick - endTick > oldVal {
|
||||
atomic.CompareAndSwapInt64(&this.maxHandleTime, oldVal, endTick - beginTick)
|
||||
}
|
||||
atomic.AddInt64(&this.okTimes, 1)
|
||||
} else {
|
||||
c.Response(`{"errcode":404, "errmsg":"接口不存在"}`)
|
||||
atomic.AddInt64(&this.pageNotFoundTimes, 1)
|
||||
|
Loading…
x
Reference in New Issue
Block a user