Timeout Function called with InvokeAsynchronous

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?

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

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