How to handle a timeout in Codeless

Dear team,

I have a timer with a task that executes in about 2.5 sec to 3.5 sec.
Operations in the task are fixed and don’t change. In fact, almost never in 4 secs.

In practice, I have encountered, out of the blue a rare 5 sec timeouts that occur (as I am in Cloud 9 plan).

This causes my timer to re-run the task and I end up with a duplicate. Is there a way, I can handle a timeout scenario using Codeless, so that I am aware of it and can address the issue.

As of now, this skips my attention, the task gets executed twice and I am aware of it only when client intimates me about it.

Any pointers will help.

Hello @Achilles_Pereira

Divide your operation into subtasks and add logging so you can see at which step problems occur.

Regards,
Inna

Thank you for the reply @Inna_Shkolnaya.

Like I said, it happens really rarely.
Even if there is no way for me to handle it, can I at least get intimated of a timeout error so that I can address it sooner than what I am currently doing. (only when client intimates).

Hi @Achilles_Pereira

At this moment we do not have a developer notifications system.

After a quick brainstorm, I can suggest you the following approach:

  1. in the timer at the very top you need to register the beginning of the timer into the Hive Set Values - Backendless SDK for JavaScript API Documentation, where the “key” might be a current timestamp and “value” could be an object with all necessary metadata
  2. then you run your timer code
  3. and at the end, you remove the “key” from the first step, which means the operation is fully completed Delete By Key Name - Backendless SDK for JavaScript API Documentation
  4. now create a new timer which can run as frequently as you need to get notifications, for instance (once a minute)
  5. in the timer you can load all keys Get All Values - Backendless SDK for JavaScript API Documentation to see what operations weren’t completed and send a notification to your system/admin email or send notification to a slack channel, or any other notifications collector

What do you think?

Regards,
Vlad