# Bug? - Homey Script card keeps running

**URL:** <https://community.homey.app/t/bug-homey-script-card-keeps-running/85024>\
**Category:** Flows\
**Created:** [July 22, 2023, 6:35am UTC](https://community.homey.app/t/bug-homey-script-card-keeps-running/85024 "2023-07-22T06:35:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tim\_R](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/tim_r/32/82292_2.png) [@Tim\_R](https://community.homey.app/u/Tim_R)\
**Post date:** [July 22, 2023, 6:35am UTC](https://community.homey.app/t/bug-homey-script-card-keeps-running/85024/1 "2023-07-22T06:35:12Z")

</div>

Hey all,

Question, am I running into a bug? I’m working on a simple flow and for that I use a little HS. In it I’ve got a while loop. While developing you have multiple iterations on your code, right? It looks like Homey keeps every version running in the background after running the test/run button.

I’ve noticed this yesterday. But even a day later the code is still logging to the console. (refreshed tab).

 ![Screenshot 2023-07-22 at 08.16.52](https://us1.discourse-cdn.com/flex025/uploads/athom/original/3X/0/a/0aba2b7f82c06cdbb7d3bff5efc4e336c015ad67.png)

Now, I’ve noticed the script stops running after a reboot.

So, three thoughts:

- Is this a bug?
- Why is there no `stop running` button?
- Why does Homey not kill the code testing process after leaving the page.

---

<div class="post-metadata">

**Author:** ![robertklep](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/robertklep/32/160628_2.png) [@robertklep](https://community.homey.app/u/robertklep)\
**Post date:** [July 22, 2023, 9:09am UTC](https://community.homey.app/t/bug-homey-script-card-keeps-running/85024/2 "2023-07-22T09:09:23Z")

</div>

It would have been useful to show the actual code, but I assume you have something like this?

```auto
while (true) {
 await fetch(...);
  await wait(2000);
}

```

**EDIT** : yes, it keeps running. Have reported it on Slack.

---

<div class="post-metadata">

**Author:** ![Tim\_R](https://sea1.discourse-cdn.com/flex025/user_avatar/community.homey.app/tim_r/32/82292_2.png) [@Tim\_R](https://community.homey.app/u/Tim_R)\
**Post date:** [July 22, 2023, 12:22pm UTC](https://community.homey.app/t/bug-homey-script-card-keeps-running/85024/3 "2023-07-22T12:22:36Z")

</div>

@robertklep Yes, indeed. Maybe the code should be watched and only run when the development modal is open. And killed on closing modal. Plus a kill button would be nice. Since you don’t want to close and open the card/modal for each code change.
