Timer question : what happens upon a timer timeout


We have a timer running out of running time, I know how to solve it but have a basic question. We do have an exception handler in the timer code that when an exception occurs it will log the error and will stop code but no abort transaction. The question now is : when the timer timout occurs (the timer does run longer as the set timer timeout) will the exception handler kick in and prevent a rollback, or will the exception happen on a higher level and thus rollback all changes? 



Hi Wim.

The thread running the timer is aborted. This will rollback the transaction automatically, and an error is logged on the timers log. If the timer hasn't yet reached the max. retries, it will be queued to be re-executed whenever possible.

Note that there's a little leeway after the configured timeout value, which I believe allows the timer to run 10% longer before being aborted, and some other factors might affect the exact time that the timer is aborted.

The thread is aborted so any code inside the thread catching an exception will be ignored ? So it will indeed be a rollback .. this sounds logical and good but isn't the thing I was hoping for ;-) back to the drawing board.. 

Hi Wim,

Please note that the timeout is different of an exception inside your code.

Wim, another thing to note is that you can use CommitTransaction to commit the timer's transaction at strategic points, for example, after processing a batch of records.

If the timer is aborted, then only the last transaction will be rolled back. In this case, just make sure your timer does not repeat work that was previously committed. I recommend you to read this article that has some best practices for timers: https://itnext.io/how-to-write-safe-timers-with-outsystems-b76ad95ca927