Method structure to "fork" 1 trigger API service to 500 parallel API service instances

Say I have Method “Trigger” and Method “calendarAdd”

My desired behavior is for Method “Trigger” to generate a list of objects and then run Method “calendarAdd” multiple times, once for each object in the list.

I am creating the desired list of objects in the variable calendarAddClean and then structuring my logic like this:

Each of the calendarAdd Methods by itself runs successfully and does not timeout.
When I disable the blue block, the API method “Trigger” is very fast as well.
But when I try to trigger a number of calendarAdd’s it times out as it waits before each loop.

I want to trigger about 500 calendar events, what is the best way to structure my logic in order to “fork” 1 trigger Method A to 500 parallel Method B instances?

Hello @Andreas_Marinopoulos

Yes, when you go through the loop it will stop on each request and wait until it’s done.
And with Codeless it is not possible to run blocks in parallel, because it breaks the sequence when blocks are running one by one.
However, I can propose you create a JS API Service do it there using Promise.all([request1, request2, requestN])

500 sounds too much for one API Service, do you consider a way to create/update/delete objects using bulk operation?

Regards, Vlad

Hmm, I don’t feel comfortable with JS. I guess I am looking at this in the wrong way, and there must be a simpler way.

I am basically looking to create recurring events in a table from a pattern in another table. Do you have sb that has done this before?

Bulk addition to the DB would not work because I also need to set relations to other tables, right?

Since this will be a timer, instead of once per day, I could do it once per hour to decrease the load significantly, is that the right way to think about it?

I am basically looking to create recurring events in a table from a pattern in another table. Do you have sb that has done this before?

try to redesign your table’s schema, perhaps it might be a specific column that determines the frequency

Bulk addition to the DB would not work because I also need to set relations to other tables, right?

it depends, for example, if you create a bunch of objects you can assign them as related to the same object

Thanks, I will try to think of the schema, but since I want individual rows each week with timestamps, like this

I need to create these on a recurring basis.

Since it times out at 27 entries, I think I will limit it to 20 and have it run more often in the day. Sounds logical?

agree, it makes sense

1 Like