let's say i have a function in google apps script that takes the data of some patients from a sheet in a google spreadsheet and updates them in a firestore database. i have the patients divided to some categories and each category is set by age and is stored in a separate sheet in the same spreadsheet. now lets assume i have a function called updatePatientsData(range) that updates the firestore database, can i run this function from the n sheets in parallel or do i have to wait for each sheet to update in order to run it from the next sheet?
Asked
Active
Viewed 75 times
1
-
1Check out [this answer](https://stackoverflow.com/a/59750451/7870403) – Ryan Jun 22 '21 at 00:49
-
so from what i understood , i can call the function many times from the client side without having to wait for the n-1 call to finish execution. But the server will queue the calls and run them one by one? – Jun 22 '21 at 01:21
1 Answers
0
you can run multiple requests at the same time, each client can process up to 50 firestore functions before being rate limited for potential spam as you can loop through several methods at once without blocking.
One thing to note however is that each document has a limit of 1 write per second per document, so multiple writes to a single document will incur degraded performance and should be optimized.

DIGI Byte
- 4,225
- 1
- 12
- 20
-
if i have every patient in a document, and that document contains subdocuments will that cause a problem? i am using this library to write to firestore btw: https://github.com/grahamearley/FirestoreGoogleAppsScript so the case here is i have a maximum of 16 calls for the function at the same time, with each call writing to different documents than the other. – Jun 23 '21 at 23:02
-
1it shouldn't, you will just need to handle the calls internally. subdocuments are not collected with the parent document, these are requested independently as the parent structure is only symbolic – DIGI Byte Jun 23 '21 at 23:15