Codeless Timer On Delay functionality not reliable

image

Hi there!

I have been working on some timers in Codeless and it seems that I have encountered some strange behaviour.
When using the Timer On Delay block, it seems that when my delay time setting is less than 200,
the timer runs fine, but when I increase this setting, the code inside the timer does not run anymore.
I think the setting is in milliseconds right?
If this is not working, I’ll probably use a delay, but I would like to know what goes wrong with the timer.
Do you have an idea?

Best regards,
Robin

Hello @Robin_van_Kuijk

This kind of blocks (Timers) actually are used in the UI-Builder for composing UI Logic and running some code while app is live, but it doesn’t make any sense inside the BusinessLogic (Server), because it runs code inside the block with some delay, and since JSCodeRunner doesn’t wait inner timers the process worker will be killed and as a result the logic will never be executed.

We are going to remove these blocks from the Backend’s Codeless. BKNDLSS-22417

Regards, Vlad

Hello Vladimir,

ok thanks for letting me know.
Do you have any alternative solutions?
I would like to start a timer of 15 minutes and after those 15 minutes the object needs to be added.
I am thinking to create a timestamp in the future (15 minutes ahead) and let a timer check when this time has been reached.
Is that an idea or do you advise something else?

Best regards,
Robin

You can run delayed code inside the API Service only if the delay less than the invocation limit (depends on your billing plan) and you have to implement a waiter to wait for the timer end to prevent the process kill until the timer is done, which is not so easy using Codeless.

I assume it’s way better to create a new Timer and run it with a particular schedule, for instance, every 15 minutes.

In the timer, you can find/update specific objects according to their created field

does it make sense?

Yes definately, I have a Billing Plan: Springboard at the moment.
The only thing I want to avoid is generate too much ineffective API calls.
If I would check the created time every 15 min, it is going to be 100+ API a day :wink:
I will think this through and see what I am able to make.
Thanks for your quick reply!