# No Sleep no system.util.invokeLater()

**URL:** <https://forum.inductiveautomation.com/t/no-sleep-no-system-util-invokelater/29393>\
**Category:** Ignition\
**Created:** [October 25, 2019, 12:58pm UTC](https://forum.inductiveautomation.com/t/no-sleep-no-system-util-invokelater/29393 "2019-10-25T12:58:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![andor.izsak](https://avatars.discourse-cdn.com/v4/letter/a/ee59a6/32.png) [@andor.izsak](https://forum.inductiveautomation.com/u/andor.izsak)\
**Post date:** [October 25, 2019, 12:58pm UTC](https://forum.inductiveautomation.com/t/no-sleep-no-system-util-invokelater/29393/1 "2019-10-25T12:58:39Z")

</div>

I understand why not to use sleep as I have experienced its shortcomings. I also understand that system.util.invokeLater() is for client side.

I have 3 tag change gateway scripts that reset a 400+ tags (counters) at the beginning of each shift using system.tag.writeAll. The trigger is the the change in shift (1,2,3) tag.  
I need to do this 10 min after shift change as well.

Using sleep and then just copy the script after worked with 1 but it doesn’t work with 2 or all 3 enabled. The sleep(600) gets applied one after an other Not at the same time.

So how would I run all 3 at the same time on the tag change and again 10 min later?  
I do have a ShiftSecond Counter I could use to do it again based on it, but I am looking for a more simple method and trying not to add more tag change scripts.

A,.

---

<div class="post-metadata">

**Author:** ![witman](https://avatars.discourse-cdn.com/v4/letter/w/d2c977/32.png) [@witman](https://forum.inductiveautomation.com/u/witman)\
**Post date:** [November 26, 2019, 7:25am UTC](https://forum.inductiveautomation.com/t/no-sleep-no-system-util-invokelater/29393/2 "2019-11-26T07:25:04Z")

</div>

> [@Write values to a tag on a Tag Change Script](http://forum.inductiveautomation.com/t/write-values-to-a-tag-on-a-tag-change-script/20088/2):
>
> There is no official way to run something “later” in the gateway. The closest would be to use a sleep inside of a invokeAsynchronous() thread. If you do this often, consider using a fast timer event script, checking a timestamp to tell it when to write false. Another possibility would be to use the ‘invokeLater’ emulation from [later.py](https://www.automation-pros.com/ignition/later.py). It uses an unofficial interface, though.
