From f9d8fb3b1fad982827d46c8c1d05aeba6718a5f6 Mon Sep 17 00:00:00 2001 From: qydysky Date: Sun, 3 Dec 2023 11:51:28 +0800 Subject: [PATCH] 1 --- main.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/main.go b/main.go index f91f572..8acc6dd 100644 --- a/main.go +++ b/main.go @@ -327,15 +327,13 @@ func wsDealer(ctx context.Context, w http.ResponseWriter, r *http.Request, route logger.L(`E:`, fmt.Sprintf("%s=>%s %v", routePath, back.Name, e)) return ErrResDoFail } else { + ctx, cancle := pctx.WithWait(ctx, 2, time.Second*45) + defer func() { + _ = cancle() + }() fin := make(chan error) reqc := req.NetConn() resc := res.NetConn() - ctx, cancle := pctx.WithWait(ctx, 2, time.Second*30) - defer func() { - if errors.Is(cancle(), pctx.ErrWaitTo) { - logger.L(`E:`, "退出超时") - } - }() go func() { ctx1, done1 := pctx.WaitCtx(ctx) defer done1() -- 2.39.2