Skip to main content
Solved

Scripting


Forum|alt.badge.img+4

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

Best answer by Alexey_Gusev

Yaniv_Amesllem- wrote:

In the question I removed un necessary data,
UpdateRemoteDB is called with different parameters for different remote DB's


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

View original
Did this topic help you find an answer to your question?

6 replies

Alexey_Gusev
Forum|alt.badge.img+23

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'


Forum|alt.badge.img+4
  • Author
  • Participating Frequently
  • 7 replies
  • July 17, 2023
Alexey_Gusev wrote:

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'


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.


Alexey_Gusev
Forum|alt.badge.img+23
Yaniv_Amesllem- wrote:

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.


it depends on what is updateRemoteDB() and why are you breaking it into several updates


Forum|alt.badge.img+4
  • Author
  • Participating Frequently
  • 7 replies
  • July 17, 2023

In the question I removed un necessary data,
UpdateRemoteDB is called with different parameters for different remote DB's


Alexey_Gusev
Forum|alt.badge.img+23
  • Brainy
  • 1145 replies
  • Answer
  • July 17, 2023
Yaniv_Amesllem- wrote:

In the question I removed un necessary data,
UpdateRemoteDB is called with different parameters for different remote DB's


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


Forum|alt.badge.img+4
  • Author
  • Participating Frequently
  • 7 replies
  • July 17, 2023
Alexey_Gusev wrote:

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


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


Reply