WICG / scheduling-apis

APIs for scheduling and controlling prioritized tasks.
https://wicg.github.io/scheduling-apis/
Other
908 stars 45 forks source link

Need to remove the entry from the task queue maps when the queue is empty #79

Closed sefeng211 closed 5 months ago

sefeng211 commented 1 year ago

We have two task queue maps in the spec, one for dynamic tasks and the other one for static tasks. The spec defines when we should add entries to those maps, but doesn't define when we should remove entries from those maps. We should remove entries when the corresponding task queues become empty.

shaseley commented 6 months ago

Thanks, good catch; I'll have a fix for this soon.

In the Chromium implementation, the dynamic priority map is keyed on a weak ref to the signal, so the entries get removed automatically when the signals get GCed. The fixed priority ones stick around.

For the spec, we can probably check the queue is empty at the end of the task and on abort, and remove the entries if that's the case.