From 948d54ef6abae6fe8e3f5290187e9ed4c4eb6869 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robin=20Br=C3=A4mer?= Date: Sat, 3 Apr 2021 22:58:02 +0200 Subject: [PATCH] close timer appropriately --- chromedp.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chromedp.go b/chromedp.go index 277a68ac..b39d1601 100644 --- a/chromedp.go +++ b/chromedp.go @@ -630,9 +630,9 @@ func Sleep(d time.Duration) Action { // Don't use time.After, to avoid a temporary goroutine leak if // ctx is cancelled before the timer fires. t := time.NewTimer(d) + defer t.Stop() select { case <-ctx.Done(): - t.Stop() return ctx.Err() case <-t.C: }