Jul 17, 2023 02:52 AM
Hello,
I am trying to debug why a certain script I wrote for automations failed because it takes more than the allowed 30 seconds. It seems that Airtable JavaScript environment doesn't support parallel execution of asynchronous tasks. Is that correct ? What can I don if I want to perform this kind of code: await Promise.all([ updateRemoteDB(), updateRemoteDB() ])
Thanks,
Yaniv
Solved! Go to Solution.
Jul 17, 2023 08:52 AM
So just update each remote DB in it's own script step.
when I wrote about 'output.set', I supposed you are querying some data from Airtable in the script, like
let query=await selectRecordAsync...
since script variables (like 'query') will be inavailable in other steps, to avoid querying many times, you can pass your data as output variable
Jul 17, 2023 07:35 AM
Hi,
Once I tried to make a script with complex evaluation that continues to run while program awaiting for some user input and finally I had to refactor it, as it seems like Airtable has some limitations with asynchronous threads.
On your place, I would break the task into several steps. You can pass json-stringified data with 'output.set'
Jul 17, 2023 07:38 AM
Thanks for you answer Alexey.
Indeed sounds like an Airtable limitation.
Can you please elaborate on your suggestion on breaking it down to tasks, using output.set? I am not sure I understand what do you mean.
Jul 17, 2023 08:20 AM
it depends on what is updateRemoteDB() and why are you breaking it into several updates
Jul 17, 2023 08:21 AM
In the question I removed un necessary data,
UpdateRemoteDB is called with different parameters for different remote DB's
Jul 17, 2023 08:52 AM
So just update each remote DB in it's own script step.
when I wrote about 'output.set', I supposed you are querying some data from Airtable in the script, like
let query=await selectRecordAsync...
since script variables (like 'query') will be inavailable in other steps, to avoid querying many times, you can pass your data as output variable
Jul 17, 2023 08:56 AM
Now I get it, thanks.
For some reason I didn't think that adding multiple actions with script is an option.
All the best,
Yaniv