btoews / OctoGAS

GitHub Email Notifications Google Apps Script for Gmail
100 stars 22 forks source link

Handle rate limit errors #6

Closed btoews closed 10 years ago

btoews commented 10 years ago

Hopefully, this PR will catch the quota errors and die gracefully, caching the work that was done so far. Then the next time the script runs, it wont have to start from scratch again. After running and dying a couple of times, this will hopefully be able to handle larger inboxes.

@gregose @mhagger would you mind giving this a shot? https://github.com/mastahyeti/OctoGAS/issues/4

mhagger commented 10 years ago

This seems to help a lot. Previously I was getting many errors of various types, for example (on one typical day):

Error Message Count
Exceeded maximum execution time 8
Service invoked too many times in a short time: gmail rateMax. Try Utilities.sleep(1000) between calls. (line 319, file "labeler") 80
Service invoked too many times in a short time: gmail rateMax. Try Utilities.sleep(1000) between calls. (line 92, file "labeler") 8

Now I am getting only the "Exceeded maximum execution time" errors (about 10 per day).

btoews commented 10 years ago

Is it at least labeling issues now?

mhagger commented 10 years ago

Yes, emails are getting labeled correctly now. The "Exceeded maximum execution time" errors are slightly annoying but don't seem to prevent the script from doing its thing (possibly 10 minutes later; I haven't been observing it closely enough to notice whether there is an additional delay when the script fails).

jssjr commented 10 years ago

Deploying from this branch and backing off my timer to 10 minutes seems to have fixed my issues as well. :+1: