Async Codeless functions

I have a use case where:

  1. I set a timer every hour to add 100 unique ids to a DB table
  2. I set an afterCreate event handler to pull in a complex external API for each of the entries in the DB table that fills up 10 more rows next to each ID

The table will contain about 2000 objects so I want to do this as elegantly as possible.

My questions:

  1. I am doing this because there is no other way to get all the information up to date without execution timeout (looping through each ID takes time). Is this a bad practice?

  2. To ensure the afterCreate event handlers are async, what do I need to do. a) nothing b) setting the non-blocking toggle to ‘on’ when I create the event handler c) wrap the codeless logic in a “run code async” block.


Hi @Andreas_Marinopoulos,

You will not win any additional time with this approach since before/after event handlers are sync - create request will return result only when all event handlers were executed. So If event handler will execute 10 seconds per each record, these 10 seconds per record (or 1000 seconds per execution) will be added to your timer execution time.

I would suggest you to look at batch operations from Backendless API as a possible way to reduce total execution time of timer. Also you can buy additional execution time for client logic in your app in the Marketplace ( “MBAAS FUNCTION PACKS” > “Business Logic” > “Enhanced Script/Code Execution Time” )

Regards, Andriy

Hi @Andriy_Konoz, The execution time will be too long I think. What does the “run code async” block do? I cannot locate any docs, could this help if I add it into a method?

I’d love to know how I can use the async block, are there any videos or docs? As I think it may be useful for me in this situation.

Hello @Andreas_Marinopoulos

This block allows you to optimize the order of code execution. This block is mainly for JavaScript users.


I think it will not help you bypass the code execution limit.


I am trying to understand what is the best way to pull in lots of information, continuously, like a chron job. I do not need the code to be executed in real time.

Assuming I have 2000 objects that need to be updated at least on an hourly basis, from what I read above, I am thinking that the best way is to create a timer that processes eg 60 every 2 minutes. That would fit within the code execution limit easily.

Is there another best practice I can try?

Hi, @Andreas_Marinopoulos

The option you suggested is a good one, try it out and look at the “run code async” block we wrote about above. If you will be limited by the available time, you can purchase an additional extension (“Enhanced Script/Code Execution Time”) that will allow you to increase your code’s execution time.