I am parsing a large text file and then calling a rate-limited Google API (mail migration) (The api docs state 1 second per call).
Even when I have Utilities.sleep(1000); inside my loop, I’m still getting this error even though I’m only setting the property one time during the loop:
Service invoked too many times in a short time: properties rateMax. Try Utilities.sleep(1000) between calls. (line 146)
Other than not setting the properties that often, what can I do to alleviate this? Should I instead try to use the CacheService to store my property transiently?
Unfortunately the exact short term rate limits aren’t exposed. You may want to try to increase your sleep amount, in the hopes of going above the threshold necessary to avoid the error. Ultimately I think your analysis is correct, that you should look into writing to the user properties less often. I’m not sure the CacheService is the right solution, but it depends on how you are using the information.