# Timeout Function called with InvokeAsynchronous

**URL:** <https://forum.inductiveautomation.com/t/timeout-function-called-with-invokeasynchronous/45862>\
**Category:** Ignition\
**Tags:** python, scripting\
**Created:** [April 21, 2021, 1:53pm UTC](https://forum.inductiveautomation.com/t/timeout-function-called-with-invokeasynchronous/45862 "2021-04-21T13:53:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![benjamin.sperl](https://avatars.discourse-cdn.com/v4/letter/b/7ea924/32.png) [@benjamin.sperl](https://forum.inductiveautomation.com/u/benjamin.sperl)\
**Post date:** [April 21, 2021, 1:53pm UTC](https://forum.inductiveautomation.com/t/timeout-function-called-with-invokeasynchronous/45862/1 "2021-04-21T13:53:59Z")

</div>

I have a screen which uses the system.tag.queryTagHistory inside of a function invoked using InvokeAsynchronous. If the user selects a long time range with many tags, sometimes it can take up to a minute to finish executing. I would like to timeout my script if it takes longer than ~10 seconds but I’m not sure the correct approach.

Has anyone ever done anything like this?

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [April 21, 2021, 1:57pm UTC](https://forum.inductiveautomation.com/t/timeout-function-called-with-invokeasynchronous/45862/2 "2021-04-21T13:57:54Z")

</div>

When called from client scope the `queryTagHistory` function has a `timeout` parameter - have you tried using that?

---

<div class="post-metadata">

**Author:** ![benjamin.sperl](https://avatars.discourse-cdn.com/v4/letter/b/7ea924/32.png) [@benjamin.sperl](https://forum.inductiveautomation.com/u/benjamin.sperl)\
**Post date:** [April 21, 2021, 3:01pm UTC](https://forum.inductiveautomation.com/t/timeout-function-called-with-invokeasynchronous/45862/3 "2021-04-21T15:01:01Z")

</div>

Ooh that should work, I hadn’t noticed that.

I put that in and it does do what I want but I’m having some issues with the exception it raises. It seems like it causes the gateway to briefly lose connection and then reconnect. I notice a blip in the screen and I see it in the diagnostics as well separate from the timeout error. Is that expected? This is from diagnostics:

Message: Connection to Gateway lost, due to exception.  
Time: Wed Apr 21 10:57:19AM  
Severity: WARN  
Logger: com.inductiveautomation.ignition.client.gateway\_interface.GatewayConnectionManager
