# How to offset gateway timer events?

**URL:** <https://forum.inductiveautomation.com/t/how-to-offset-gateway-timer-events/116393>\
**Category:** Ignition\
**Tags:** ignition81\
**Created:** [July 14, 2026, 12:29pm UTC](https://forum.inductiveautomation.com/t/how-to-offset-gateway-timer-events/116393 "2026-07-14T12:29:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![danielps1818](https://avatars.discourse-cdn.com/v4/letter/d/ecae2f/32.png) [@danielps1818](https://forum.inductiveautomation.com/u/danielps1818)\
**Post date:** [July 14, 2026, 12:29pm UTC](https://forum.inductiveautomation.com/t/how-to-offset-gateway-timer-events/116393/1 "2026-07-14T12:29:31Z")

</div>

I have 2 gateway timer events.  
Both of those update all the rooms in our plant.

We decided that the best solution to not block the event is to call invokeAsynchronus function.  
So every 5 minutes or so the script executes and generate about 20-30 new threads that update each room.

Our problem is that both events execute at the same time. So every 5 minutes instead of having 20-30 threads we have about 40-60 threads.

Is there any way to offset the events so execute about 2,5 minutes apart?

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/6/d682f131c2c99bae82ffbbafda6df20ed58c2a8d.png)

Thx in advance!

---

<div class="post-metadata">

**Author:** ![fakcior](https://avatars.discourse-cdn.com/v4/letter/f/ee59a6/32.png) [@fakcior](https://forum.inductiveautomation.com/u/fakcior)\
**Post date:** [July 14, 2026, 12:30pm UTC](https://forum.inductiveautomation.com/t/how-to-offset-gateway-timer-events/116393/2 "2026-07-14T12:30:45Z")

</div>

What about using scheduled events instead?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [July 14, 2026, 12:38pm UTC](https://forum.inductiveautomation.com/t/how-to-offset-gateway-timer-events/116393/3 "2026-07-14T12:38:08Z")

</div>

Making threads is a pretty heavy-weight operation. Don't do this. Consider using a 1-minute scheduled event, and based on the modulus of the minute of the hour, execute 20% of the work.

If you really need some parallelism, consider creating a thread pool executor with a fixed pool size, and submitting all of the tasks every 5 minutes.

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [July 14, 2026, 1:52pm UTC](https://forum.inductiveautomation.com/t/how-to-offset-gateway-timer-events/116393/4 "2026-07-14T13:52:13Z")

</div>

A (very) simple example. You will need to take into account frequency and offset. :

```python
schedule = [{'script': path.to.script1, 'frequency': 5, 'offset': 0},
            {'script': path.to.script2, 'frequency': 5, 'offset': 3}
           ]

now = system.date.now()

if (now.minutes - item['offset']) % item['frequency'] == 0:
	item['script']()

```
