# Multiple PLATFORM queueTask timing problem

**URL:** <https://discourse.aurelia.io/t/multiple-platform-queuetask-timing-problem/4898>\
**Category:** Help Requests\
**Created:** [September 2, 2022, 9:24am UTC](https://discourse.aurelia.io/t/multiple-platform-queuetask-timing-problem/4898 "2022-09-02T09:24:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![aGustafson](https://avatars.discourse-cdn.com/v4/letter/a/977dab/32.png) [@aGustafson](https://discourse.aurelia.io/u/aGustafson)\
**Post date:** [September 2, 2022, 9:24am UTC](https://discourse.aurelia.io/t/multiple-platform-queuetask-timing-problem/4898/1 "2022-09-02T09:24:34Z")

</div>

Hi,

I am using queueTasks insteam of setInterval in various parts of my app.

In one case, I want to update the time display every minute. I want to fetch data from an API every 1.5 seconds, then I need a typewritter effect that types a new letter every 300ms.

```nohighlight
        this.fetchTask = PLATFORM.taskQueue.queueTask(() => {
            this.fetchData();
        }, {delay: 1500, persistent: true})

```

It looks like the timing of one task is influencing others. My typewritter effect only typing at 1 character per minute!

Is this a bug, or an I using this wrong?

---

<div class="post-metadata">

**Author:** ![fkleuver](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/fkleuver/32/994_2.png) [@fkleuver](https://discourse.aurelia.io/u/fkleuver)\
**Post date:** [September 2, 2022, 12:57pm UTC](https://discourse.aurelia.io/t/multiple-platform-queuetask-timing-problem/4898/2 "2022-09-02T12:57:15Z")

</div>

Sounds like the tab may be inactive, 1 per minute is what the browser throttles `setInterval` to when the tab is in the background or put to sleep

---

<div class="post-metadata">

**Author:** ![aGustafson](https://avatars.discourse-cdn.com/v4/letter/a/977dab/32.png) [@aGustafson](https://discourse.aurelia.io/u/aGustafson)\
**Post date:** [September 2, 2022, 2:32pm UTC](https://discourse.aurelia.io/t/multiple-platform-queuetask-timing-problem/4898/3 "2022-09-02T14:32:50Z")

</div>

No, if I change all the values to 300ms then everything works at 300ms. My Typewritter effect is good, but then I am calling an API needlessly 3 times per second and will probably get into trouble with the maintainer of the server once people start using the page.

---

<div class="post-metadata">

**Author:** ![fkleuver](https://yyz1.discourse-cdn.com/flex027/user_avatar/discourse.aurelia.io/fkleuver/32/994_2.png) [@fkleuver](https://discourse.aurelia.io/u/fkleuver)\
**Post date:** [September 2, 2022, 2:35pm UTC](https://discourse.aurelia.io/t/multiple-platform-queuetask-timing-problem/4898/4 "2022-09-02T14:35:26Z")

</div>

Could you create a GH issue with a minimal repro please?

---

<div class="post-metadata">

**Author:** ![aGustafson](https://avatars.discourse-cdn.com/v4/letter/a/977dab/32.png) [@aGustafson](https://discourse.aurelia.io/u/aGustafson)\
**Post date:** [September 5, 2022, 10:54am UTC](https://discourse.aurelia.io/t/multiple-platform-queuetask-timing-problem/4898/5 "2022-09-05T10:54:50Z")

</div>

I created an issue on GH and a repro

> <https://github.com/aurelia/aurelia/issues/1542>
>
> \# 🐛 Bug Report
> 
> When using multiple instances of PLATFORM.taskQueue.queueTask …as a replacement for setTimeout. It appears that the longest delay value is used for all instances.
> 
> Repro link https://github.com/alexgustafson/multiple-queuetask-timing
> 
> \## 🤔 Expected Behavior
> 
> I would expect that each instance of queueTask would repeat at its own set delay time.
> 
> \## 😯 Current Behavior
> 
> All instances use the same delay time. Its seems that the longest ( largest ) value wins.
> There is no error.
> 
> \## 💁 Possible Solution
> 
> I am using native setTimeout instead.
> 
> \## 🔦 Context
> 
> 
> \## 💻 Code Sample
> Here is a link to an example Aurelia v2 project. There are three components, typing text into the view. Each should be typing at a different speed. 
> 
> https://github.com/alexgustafson/multiple-queuetask-timing
> 
> \## 🌍 Your Environment
> 
> 
> 
> | Software | Version(s) |
> | ---------------- | ---------- |
> | Aurelia | v2 2.alpha 39 |
> | Language | typescript |
> | Browser |
> | Bundler |
> | Operating System |
> | NPM/Node/Yarn |
