CTS: Allow sync code to interrupt and cancel a scheduled heartbeat

Bug: chromium:1340602
Change-Id: Id6f8d58bd283c8232af533cf2a0fe74adb704336
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/102180
Reviewed-by: Ben Clayton <bclayton@google.com>
Commit-Queue: Austin Eng <enga@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
This commit is contained in:
Austin Eng 2022-09-13 18:28:31 +00:00 committed by Dawn LUCI CQ
parent e667d777ac
commit 26ffcd1768
1 changed files with 2 additions and 3 deletions

View File

@ -37,9 +37,8 @@ function rateLimited(fn, intervalMs) {
let last = undefined;
let timer = undefined;
const wrappedFn = (...args) => {
if (timer !== undefined || last === undefined) {
// If there is already a fn call scheduled, or the function is
// not enabled, return.
if (last === undefined) {
// If the function is not enabled, return.
return;
}
// Get the current time as a number.