PLATFORM.taskqueue does not run concurrent tasks

Hey people!

I am using the PLATFORM.taskQueue in several places throughout my app, and globally at the topbar to show time down to seconds. Every now and then, the seconds would stop counting and I never really realized a pattern until recently as to why.

It seems when I queue a task with a delay, it halts the execution of other queued tasks. When I think about it now, it makes sense, if there is one single task queue, the delay of the next-in-line task should stall the others, however the way PLATFORM.taskQueue is described in the docs as a direct alternative to setTimeout or setInterval is misleading in this case, since there is a very strict difference between the two approaches: being concurrent vs. being consecutive.

Is there something that I am missing in the docs, or not seeing in the API? If not, it would make sense to clarify this difference in the docs or maybe allow concurrency somehow. Because as is, contrary to what the docs would make the reader believe, taskQueue is not really a substitute of the latter two.

It seems there is a GitHub issue pointing to this behaviour: Platform taskQueue multiple instances all use the same delay value · Issue #1542 · aurelia/aurelia · GitHub

which is also referenced from this topic: Multiple PLATFORM queueTask timing problem

I created a small repro of the issue: The two counts should meet at multiples of 10, but they don’t:

3 Likes