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:


FYI, this PR fixes it so it should be soon released with the new dev version:

Thank you for the clean repro, it helped!

1 Like

You are most welcome @fkleuver and thank you too. Looking forward to test it in the next release :+1: