Hello, 

I am planning web app with asynclonous background job by Timer.
The timer task will awake by using Awake Action in web request.
So, I created test module to confirm about multiple request to timer action which leads sleeping 10 secs.

And I called this screen action multiple times.

However the timer actually performed only 3 times.
And I found no error.

I want to know how a new timer schedule will be treated during execution of the timer task.

The test module is attached to this post.
The module depends on following forge component.
https://www.outsystems.com/forge/component-overview/1244/sleep

Sincerely,
Moriya Takasi

Hello Maria,

Thank you for your comment.
However I couldn't find information about Awake action behavior in the page.
Especially for the case of calling Awake action during the timer running already.

Solution

Hi Moriya Takasi,

You can find the documentation on the Wake<Timer Name> action here. So basically what the action does when executed is update the Next Run property of the timer. The Scheduler Service will then handle the execution.

Off the top of my head, in your case since your timer runs for about 10 seconds, I think what happens is you execute the WakeTimer action a few times during that 10 seconds and the Next Run property of your timer will keep getting updated for each time you executed the action. In the end, the timer will not run 10 times. 

If you want it to run 10 times for each execution of the WakeTimer action, you would have to make sure you only update the Next Run property once during that 10 seconds. So when the second timer execution is on the way, you can execute the WakeTimer action again, and so on.

Hope this helps!

Regards,

Nordin

Solution

Hello Nordin Ahdi,

Thank you for your explanating detaily.
I now understand that Awake action is not to add waiting queue but to update next-run property.
It is very clear for me.

Thank you very much.

Hello Takasi, 

Nordin already explained the behaviour of the timer wake action, that explains why you don't get execution for each time you execute the wake. 

Let me expand the answer saying that timers are not to be used 'per user', even if you can wake a timer based on an user interaction. 

The solution to allow multiple instances of a background execution is to use BPT instead. 

You can have multiple processes running, and you can launch them manually or automatically (new record in an entity). 

So, depending on what you want to do, BPT is the way. 

Cheers 

Hello Eduardo,

Thank you for your additional information.
The task I am plannning currently is for using external service in system global scope. So, I will use Timer for this.
When background tasks I will plan in the future require input parameters or login user's specific info, I should try to use BPT or light weight process.