Skip to content

Commit bf3722b

Browse files
author
chenjie
committed
Merge branch 'main' of github.com:chenjie199234/Corelib into main
2 parents fe5048b + 1ff926e commit bf3722b

File tree

3 files changed

+3
-12
lines changed

3 files changed

+3
-12
lines changed

cgrpc/server.go

+1-4
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,7 @@ func (this *CGrpcServer) UpdateHandlerTimeout(htcs map[string]time.Duration) {
203203

204204
func (this *CGrpcServer) getHandlerTimeout(path string) time.Duration {
205205
handlerTimeout := *(*map[string]time.Duration)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(&this.handlerTimeout))))
206-
if t, ok := handlerTimeout[path]; ok {
207-
if this.c.GlobalTimeout <= t {
208-
return this.c.GlobalTimeout
209-
}
206+
if t, ok := handlerTimeout[path]; ok && (this.c.GlobalTimeout == 0 || t < this.c.GlobalTimeout) {
210207
return t
211208
}
212209
return this.c.GlobalTimeout

crpc/server.go

+1-4
Original file line numberDiff line numberDiff line change
@@ -211,10 +211,7 @@ func (this *CrpcServer) UpdateHandlerTimeout(htcs map[string]time.Duration) {
211211

212212
func (this *CrpcServer) getHandlerTimeout(path string) time.Duration {
213213
handlerTimeout := *(*map[string]time.Duration)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(&this.handlerTimeout))))
214-
if t, ok := handlerTimeout[path]; ok {
215-
if this.c.GlobalTimeout <= t {
216-
return this.c.GlobalTimeout
217-
}
214+
if t, ok := handlerTimeout[path]; ok && (this.c.GlobalTimeout == 0 || t < this.c.GlobalTimeout) {
218215
return t
219216
}
220217
return this.c.GlobalTimeout

web/server.go

+1-4
Original file line numberDiff line numberDiff line change
@@ -369,10 +369,7 @@ func (this *WebServer) UpdateHandlerTimeout(htcs map[string]map[string]time.Dura
369369
func (this *WebServer) getHandlerTimeout(method, path string) time.Duration {
370370
handlerTimeout := *(*map[string]map[string]time.Duration)(atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(&this.handlerTimeout))))
371371
if m, ok := handlerTimeout[method]; ok {
372-
if t, ok := m[path]; ok {
373-
if this.c.GlobalTimeout <= t {
374-
return this.c.GlobalTimeout
375-
}
372+
if t, ok := m[path]; ok && (this.c.GlobalTimeout == 0 || t < this.c.GlobalTimeout) {
376373
return t
377374
}
378375
}

0 commit comments

Comments
 (0)