EXTEND TIME LIMIT EXECUTION

5,099 views
Skip to first unread message

chen malazarte

unread,
Jun 20, 2021, 8:32:50 PM6/20/21
to Google Apps Script Community
Is there a way to pay for extending the time limit execution for single apps script? 

Alan Wells

unread,
Jun 20, 2021, 9:38:09 PM6/20/21
to Google Apps Script Community
The documentation for the quota limits is at:

At one point I thought that the time limit for Apps Script running on a Workspace account was going to be 30 minutes instead of 6 minutes.
But the documentation shows absolutely no difference between the consumer and Workspace accounts in the current limitations table.
So, I don't know if Google decided to revert back to lower limits for the Workspace account, or what happened.
I'd like to get some feedback from others about what their understanding was, and if they have any information.

According to the following Stack Overflow post:

The runtime in the documentation 7 months ago stated that the run time for Apps Script in a Workspace account was supposed to be 30 minutes.  So, it seems like this is kind of a mystery.   I don't know if Google decided to quietly get rid of the 30 minute extended time for a Workspace account, or if the documentation is wrong.

dimud...@gmail.com

unread,
Jun 20, 2021, 9:55:36 PM6/20/21
to Google Apps Script Community
Unfortunately, no. Google does not currently provide such an option.

However, depending on your use-case you might be able to leverage one of the following options: 
  1. Refactor your code to run more efficiently by optimizing the code to run within 6 minutes.
  2. Convert your script to run as a batch operation, where the script's process is spread out over multiple executions, where the time slice for each execution is under the 6 minute limit. Time-based triggers should help with this.
  3. Offload the time-intensive parts of the process to a 3rd party service; and have your script call out to it with the appropriate parameters.


On Sunday, June 20, 2021 at 8:32:50 PM UTC-4 chenmala...@gmail.com wrote:

Joshua Snyder

unread,
Jun 21, 2021, 5:48:21 AM6/21/21
to Google Apps Script Community
Great advice, if the bulk of the work doesn't require GAS specific functions then you can hand it to a backend server for processing. Otherwise, the only way is to split it into 6 minute chunks, which you can do by starting a timer and checking the value of that timer at each iteration in your script.

Adam Morris

unread,
Jun 21, 2021, 6:00:28 AM6/21/21
to google-apps-sc...@googlegroups.com
I can confirm there was a period of about six months or a year where the execution limit was an absolutely luxurious 30 minutes for edu. As the documentation states, they can change it at any time without warning. I imagine there were some engineers who pointed out all the electricity these long running scripts were using and got it pulled back to the original 6 minutes. 

As for options other than those given, I have several mission critical scripts that do operations that take significant processing time. I’m not really able to offload it to background tasks on another service, so these are the strategies I use. I tend to use these strategies even when I’m not concerned with going under the quota:

UrlfetchApl has a method fetchall that can be used to call multiple endpoints at the same time. The responses that come back are in same order as they were built. I have found significant speed up of a function, for example, that reads in all the group members of 20 different groups. Doing it one by one with admin directory service would take about 10 seconds, but by interacting with the api directly with the UrlfetchApp, it takes about a second. 

(Note to self, I really need to release performance stats to back these claims up.)

The other strategy is that I use advanced services as it has more flexibility and more can be accomplished faster. The spreadsheet service has a batch update endpoint which seems to be the most efficient way to send spreadsheet writes. 

Both those methods require more typing, but I’ve written libraries (“Endpoints”) that reduce this overhead. 

Regards,

Adam



--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/b78ed9cd-d795-4c18-a416-70ac2895e4aan%40googlegroups.com.
--

dimud...@gmail.com

unread,
Jun 21, 2021, 7:49:29 AM6/21/21
to Google Apps Script Community
@Adam UrlScriptApp.fetchAll() is convenient, but it does impact your usage quotas. Before fetchAll was available, devs would typically leverage the batch request endpoint of a Google API (via REST) directly. Its more work to implement, but one could bundle up to 100 requests, in one UrlFetchApp.fetch query. With fetchAll(), each request counts towards the quota (20,000 UrlFetchApp.fetch queries per day for consumer accounts, 100,000 per day for paid accounts), whereas calling the batch request endpoint of a Google API directly only counted as one request (at least that how I recalled it worked, Google may have made changes since adding fetchAll).  

Adam Morris

unread,
Jun 21, 2021, 8:13:56 AM6/21/21
to google-apps-sc...@googlegroups.com
That’s a good point about the quota that apply other than those that are time-based. 

--

Joshua Snyder

unread,
Jun 21, 2021, 10:50:03 AM6/21/21
to Google Apps Script Community
I have always been confused about quotas for apps script. Does the 20,000 url fetch call limit per day (and other quotas listed here under Current Quotas) apply to the whole script or to the user of the script?

In an Add-On, can a single user make up to 20,000 UrlFetch requests or can all users of the script only make 20,000 UrlFetch requests in total? And does the difference between @gmail and GSuite quotas apply to the user or to the owner of the script?

Would be great to get more information on this!

Thanks,

Joshua





Darren D'Mello

unread,
Sep 6, 2021, 6:09:51 AM9/6/21
to Google Apps Script Community
I see not difference in script execution time for gmail and workspace accounts. Can anyone suggest which plan currenly would have the 30 minutes execution?
I didnt find any documentation about GSuite Business/Enterprise accounts script execution time.

Any ideas?

Alan Wells

unread,
Sep 6, 2021, 11:28:44 AM9/6/21
to Google Apps Script Community
It seems that Google has rolled back the 30 minute execution time for Workspace accounts.
I don't know if it's announced anywhere.
I did some searching and could only find the following post at StackOverflow.
If anyone has more or better information please let us know.
Reply all
Reply to author
Forward
0 new messages