1

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.

Mask
  • 573
  • 7
  • 24
  • 1
    I would think that you'll have a problem using google apps scripts with more than 30 simultaneous users. – Cooper Sep 07 '19 at 19:43
  • What's the solution? Should I increase script release time? – Mask Sep 07 '19 at 19:46
  • [Hard Quotas](https://stackoverflow.com/a/56645656/) usually cannot be circumvented. – TheMaster Sep 07 '19 at 21:07
  • 2
    If there are [>30 concurrent calls](https://stackoverflow.com/a/50033976), I'm assuming your script won't even start to execute. So, there is no question of `Lock` to rescue. – TheMaster Sep 07 '19 at 23:23
  • What if I make a google web app will these restriction also applies with do get scripts?? – Mask Sep 08 '19 at 15:08
  • Yes. I believe so – TheMaster Sep 08 '19 at 22:15
  • 1
    For testing purposes you can fill out some forms and then go from the Script UI to View->Executions to see the duration of each execution. Assuming that your script is simple, the duration will be below one second. If so, you are unlikely to run into problems executing the script without a lock. How will the students receive the invitation to fill out the attendance form? Per email? In this case you can send the invitation to half of the students first, and to the other half a little later. – ziganotschka Sep 09 '19 at 10:40
  • @ziganotschka most probably everyone will bookmark these form links and will mark attendance as per their entry in class. – Mask Sep 10 '19 at 08:44

2 Answers2

2

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.

  • That Means if I make same but many(copy) scripts(with different accounts) then that will do the job? How many additional account would I need If I have a G Suite account? – Mask Sep 08 '19 at 14:49
  • 1
    That depends on how long it takes your script to run. If your script only takes 3 seconds to run, it will only take 1 hour (with 1200 students), so you wouldn't need an additional account. Additionally, using multiple accounts to accomplish this would be very difficult to manage and maintain as you will have form submissions in several different places and several different scripts to manage. If possible, it would be better to release your form to groups of students over the course of a couple days instead of everyone at the same time (if the script takes too long to run) – Efficient Small Business Sep 11 '19 at 15:55
1

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.

Jeremy
  • 2,321
  • 3
  • 21
  • 24