Subhash Kapoor
Subhash Kapoor

Reputation: 27

Service using too much computer time for one day

This indicates that the script exceeded the total allowable execution time for one day. It most commonly occurs for scripts that run on a trigger, which have a lower daily limit than scripts executed manually. The limit as far as I am aware is 6 hours per day. None of my scripts run for that long.

Everything was fine earlier. Suddenly, over the last 3-4 days, all the scripts have started failing. I have no clue what's happening. My only hunch is that one of my scripts is going into an infinite loop. But still, if that happens, it will fail soon and collectively, all scripts would not run for 6 hours.

Upvotes: 0

Views: 3703

Answers (2)

CRH
CRH

Reputation: 9

I had a similar problem. It's a little maddening because getting an error for the script leads one to believe it is a possible syntax problem. More likely, the script never ran in the first place, which is why you likely don't have a failed execution status for the trigger. What may have happened instead is that you have a script or scripts that are still firing for documents that no longer exist.

  1. Navigate to "My Triggers" in the G Suite Developer Hub: https://script.google.com/home/triggers

  2. Click on any time-based events and select "executions."

  3. Search the "status" column for the words "Timed out," and check the duration.
  4. Delete the trigger(s) that is timing out, or otherwise resolve why it is timing out (such as restoring the deleted document).

In my case, I had deleted several old spreadsheets, but one of my add-ons (Supermetrics) was still firing triggers. I had incorrectly assumed that when I deleted my spreadsheets the triggers would have gone with them. Instead they were firing and timing out after about six minutes, and then four hours later they would try to execute again. I added up the duration for all of these triggers and, sure enough, it exceeded my quota.

Delete those old triggers, and you'll likely be back within your quota limits the next day when it resets. This is what worked for me, but I imagine it's not a one-size fits all solution.

Upvotes: 0

Chris
Chris

Reputation: 2107

The exception message should also tell you a lot about what is happening. If you are not sure which script is causing the issues you can try to go to the Google Apps Script Manager. In the menu bar on the left you will see a section called My Executions. If you click that you can see a list of scripts that ran and how long they ran for. This page also allows you to sort by duration and filter the results to hopefully help you figure out what is going on.

It possible that you have reached your quota. Having a Google Suite account allows you up to 6 hrs/day of Trigger Total Runtime. Also make sure you are not going over the limit on single script runtime as outlined here further down on the Quota For Google Services page.


For Google Suite Accounts the quota is:

Script runtime: 6 min/execution

Custom function runtime: 30 sec/execution

Upvotes: 2

Related Questions