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:
parent
e667d777ac
commit
26ffcd1768
|
@ -37,9 +37,8 @@ function rateLimited(fn, intervalMs) {
|
||||||
let last = undefined;
|
let last = undefined;
|
||||||
let timer = undefined;
|
let timer = undefined;
|
||||||
const wrappedFn = (...args) => {
|
const wrappedFn = (...args) => {
|
||||||
if (timer !== undefined || last === undefined) {
|
if (last === undefined) {
|
||||||
// If there is already a fn call scheduled, or the function is
|
// If the function is not enabled, return.
|
||||||
// not enabled, return.
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Get the current time as a number.
|
// Get the current time as a number.
|
||||||
|
|
Loading…
Reference in New Issue