From cf6e6abc68fb1d20475bafaa65d9f96b23ae3773 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Mon, 28 Oct 2019 17:55:38 -0700 Subject: [PATCH] runtime: clear js idle timeout before new one and after event handler Updates #6239 Updates #27707 Change-Id: I0a62c1374db485dd830bf02e59625997d9247fc3 Reviewed-on: https://go-review.googlesource.com/c/go/+/203890 Run-TryBot: Ian Lance Taylor TryBot-Result: Gobot Gobot Reviewed-by: Brad Fitzpatrick --- src/runtime/lock_js.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/runtime/lock_js.go b/src/runtime/lock_js.go index 51cbe60607..df52ea04fd 100644 --- a/src/runtime/lock_js.go +++ b/src/runtime/lock_js.go @@ -158,6 +158,7 @@ var idleID int32 // If an event handler returned, we resume it and it will pause the execution. func beforeIdle(delay int64) bool { if delay > 0 { + clearIdleID() if delay < 1e6 { delay = 1 } else if delay < 1e15 { @@ -229,6 +230,7 @@ func handleEvent() { func handleAsyncEvent() { isHandlingEvent = true eventHandler() + clearIdleID() isHandlingEvent = false } -- 2.50.0