From: qydysky Date: Fri, 2 Jun 2023 19:55:08 +0000 (+0800) Subject: add X-Git-Tag: v0.28.0+2023060218588d4 X-Git-Url: http://127.0.0.1:8081/?a=commitdiff_plain;h=18588d48cbe186dcae112890d50c858cebf99711;p=part%2F.git add --- diff --git a/reqf/Reqf.go b/reqf/Reqf.go index f3c9818..707cea7 100644 --- a/reqf/Reqf.go +++ b/reqf/Reqf.go @@ -405,8 +405,16 @@ func (t *Req) withCtxTO(ctx context.Context, to time.Duration, w io.Writer, r io for { select { case <-ctx.Done(): - if chanw.Load() != 0 { - panic(fmt.Sprintf("write blocking after Ctx Done, goruntime leak \n%v", callTree)) + if old, now := chanw.Load(), time.Now(); old != 0 && now.Unix()-old > int64(to.Seconds()) { + if chanw.Load() != 0 { + panic(fmt.Sprintf("write blocking after %v, goruntime leak \n%v", now.Unix()-old, callTree)) + } + } else { + time.AfterFunc(to, func() { + if chanw.Load() != 0 { + panic(fmt.Sprintf("write blocking after %v, goruntime leak \n%v", now.Unix()-old, callTree)) + } + }) } return case now := <-timer.C: