Can you put a time-out in a thread?

I'm invoking system.util.invokeAsynchronous and sometimes the scripts get stuck in loops or reexecuting (not wrong, could happend).

Can you put a timeout in threads, even if it's globally? and how?

Thanks!

No, not safely. The closest you can get is to handle java interruptions, which produce exceptions in many OS operations. The interruption itself would be sent externally--another thread or some timer script would have to detect the overtime condition and send the interrupt.

Generally, though, write defensive code, with try: - except: blocks where needed, and use API calls that have timeouts.

1 Like