问题
I have a Google Attendance form which triggers an apps script through spreadsheet connected to the form. My issue is that when around 1200 student will fill the form most probably at the same time, will the script overlap the data?? I saw google developer post where they have mentioned to lock the script for 30 seconds (lock.waitLock(30000); lock.releaseLock();)
will it be enough to use the suggested method to prevent script from overlapping data of around 1200 students?
I cant test the script in live environment that is why I have to ask the question.
回答1:
Per Google's documentation there is a limit of 30 simultaneous executions. So it would be necessary to use the lockservice to prevent to many submissions. You must also consider the amount of time it takes for your script to run.
Here are the quotas for the total trigger runtime:
- Consumer account: 90 minutes
- G Suite account: 6 hours
If you have 1200 students and it takes up to 30 seconds for each execution that is 600 minutes/10 hours which exceeds both limits. You should test how long it takes your script to run.
This quota is the "total trigger runtime", so if you have other triggers that are used in other spreadsheets, they count against your total time.
回答2:
I think it will be fine. As long as your script is pretty fast, you won't hit any quota limits. If you do, the symptom will look like you missed a call to onFormSubmit(). In which case you should create some indication that you are done processing each row so that you know which ones were missed.
来源:https://stackoverflow.com/questions/57836830/google-script-used-by-multiple-user