Skip to content

Commit cf6e6ab

Browse files
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 <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Brad Fitzpatrick <[email protected]>
1 parent cc4b824 commit cf6e6ab

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/runtime/lock_js.go

+2
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ var idleID int32
158158
// If an event handler returned, we resume it and it will pause the execution.
159159
func beforeIdle(delay int64) bool {
160160
if delay > 0 {
161+
clearIdleID()
161162
if delay < 1e6 {
162163
delay = 1
163164
} else if delay < 1e15 {
@@ -229,6 +230,7 @@ func handleEvent() {
229230
func handleAsyncEvent() {
230231
isHandlingEvent = true
231232
eventHandler()
233+
clearIdleID()
232234
isHandlingEvent = false
233235
}
234236

0 commit comments

Comments
 (0)