many non-update "updates" causing script failures
Hi folks, This script fails for me, sometimes 2-3 times in a day, due to this error.
GoogleJsonResponseException: API call to people.people.updateContact failed with error: Quota exceeded for quota metric 'Critical read requests (Contact and Profile Reads)' and limit 'Critical read requests (Contact and Profile Reads) per minute per user' of service 'people.googleapis.com' for consumer 'project_number:366785192996'. at SpreadsheetToContacts(Code:341:27) at syncContacts(Code:186:3)
When I look at the failed runs, I see that it was attempting to process updates on ~200 of my contacts all in one iteration. I did not update anywhere near that many contacts! Maybe 1 or 2 in the last couple of days!
I went into my sync spreadsheet, and I found one of the numbered contacts, and in Sheets I highlighted the first populated cell in that row (it happens to be column C), and right-click > show edit history. (I obscured the email address here for privacy)
Replaced: "[{"formattedType":"Work","displayName":"Mail","type":"work","metadata":{"primary":true,"sourcePrimary":true,"source":{"type":"CONTACT"}},"value":"[email protected]"}]" with "[{"type":"work","value":"[[email protected]](mailto:[email protected])","metadata":{"primary":true,"source":{"type":"CONTACT"},"sourcePrimary":true},"displayName":"Mail","formattedType":"Work"}]"
There's no change in the content, only in the format of the data. FYI in the example, the change to the contact was apparently made in my personal/home Gmail account (but no change by me) and written to the spreadsheet. This script failure is in my work (Google Workspace Enterprise) account, when it's trying to update the Contact.
So.... what's making the script create all of these "updates" where there is no actual update? I'm sure it's something Google is doing... but why? and can we circumvent it?
I've noticed this before, over weeks, it didn't just start today. Other than this, the script is working beautifully for me, for many months now.
@fleapower any insight on this? thanks
Every time you update a contact (which includes every time you call or email them), the contact will be updated and therefore needs to be sync'd. As for the failures, I wouldn't worry about it if the contacts seem to be sync'ing. Google has a quota for how long a script can run. If the script exceeds that time (for instance, with lots of contacts), it will be terminated. However, the token for the sync will not be reset so it will continue to sync using the spreadsheet until all of the changes have been sync'd.