Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calendar usage limits exceeded. #167

Closed
michaelh82 opened this issue Nov 26, 2020 · 11 comments
Closed

Calendar usage limits exceeded. #167

michaelh82 opened this issue Nov 26, 2020 · 11 comments
Labels
bug Something isn't working

Comments

@michaelh82
Copy link

Hi

I noticed that my Apple Calendars have randomly stopped syncing to Google Calendar. Upon looking at the executions, I see the following:

Error, Retrying...GoogleJsonResponseException: API call to calendar.events.insert failed with error: Calendar usage limits exceeded.

I see this that this looks to be an issue with too many events being created in a short period: https://support.google.com/a/answer/2905486.

Does anyone know how I can get around this issue - i.e. should I be setting the script to run less often, or shall I set it to not sync past events, etc? This is my current set up:

var howFrequent = 15;        
var onlyFutureEvents = false;
var addEventsToCalendar = true;
var modifyExistingEvents = true;
var removeEventsFromCalendar = true;
var addAlerts = true;
var addOrganizerToTitle = false;
var descriptionAsTitles = false;
var addCalToTitle = false;
var addAttendees = false;
var defaultAllDayReminder = -1; 
var addTasks = false;
var emailSummary = false;
var email = "";

Thanks in advance for your help.

Michael

@michaelh82 michaelh82 added the bug Something isn't working label Nov 26, 2020
@jonas0b1011001
Copy link
Collaborator

Past events will not be send to the calendar unless they were modified which seems rather unlikely. Therefore onlyFutureEvents will probably not have an impact on how many API calls the script makes.

If you do not sync time sensitive data that needs to be synced within 15mins I would recommend to try longer sync intervals.

@michaelh82
Copy link
Author

Thanks for the reply and sorry for the delayed response. I have been trying a few things, including:

However, once setting the billing account, I cannot get my head around how to change the quotas. But, I am not even sure if these are the steps I should be following to solve this issue. If so, I can get in touch with Google to get their assistance with this.

The issue is still happening, so it looks like the quota will not automatically reset itself anytime soon. So, I assume I will need to pay to get a higher quota to continue to run this script.

Has anyone else ever experienced these issues that you know of?

Thanks
Michael

@derekantrican
Copy link
Owner

@michaelh82 I can take a look at the calendar and see if anything stands out. If you're worried about sharing sensitive date you can use https://derekantrican.github.io/icssanitizer.html

@michaelh82
Copy link
Author

Thanks for coming back to me @derekantrican and sorry for the delay - I thought the issue had fixed itself, as some events started syncing okay. But, I have been keeping a close eye and it is temperamental - some events sync and then others don't, as limits seem to be reached. For example, I added an event to one of the iCloud calendars this morning - it's been about 8 hours now and it has not synced yet. In the executions, I see it says the limits have been reached again.

I have tried the sanitizer tool, but can't get it to work. However, I am not too worried about using this, as there won't really be any sensitive data. How do I share the calendar? Do you just need the webcal URL's?

@derekantrican
Copy link
Owner

Yes, that'd be great

@michaelh82
Copy link
Author

Wicked, thanks...links below:

webcal://p22-caldav.icloud.com/published/2/OTE0NjA5NDY5MTQ2MDk0NqGJmRHMkhFfgldPK_AnVyQjbxG3kNQJM3IIprl1qlu_nrxOWLFrRocYtrQicB44GlTWJWQUolgIALK3yYTzZl4

webcal://p22-caldav.icloud.com/published/2/OTE0NjA5NDY5MTQ2MDk0NqGJmRHMkhFfgldPK_AnVySGhsPKq-qRf34HJ3xpIQS8

webcal://p22-caldav.icloud.com/published/2/OTE0NjA5NDY5MTQ2MDk0NqGJmRHMkhFfgldPK_AnVySfd3Zu-KEXi83nUMdEMvmufKcsl1RLpb8-6RRYLSjg5O10EtOAO45ZtztzOOYMqS0

webcal://p22-caldav.icloud.com/published/2/OTE0NjA5NDY5MTQ2MDk0NqGJmRHMkhFfgldPK_AnVySa0mjN2gICR6IEQhr5ZTM7z6oWK3Ac3wCCz9oZfwR9dCdQol6M1rpUMwqim5Kis_s

If you need anything else, just let me know.

@hobbs
Copy link

hobbs commented Feb 24, 2021

I'm also getting, "Error, Retrying...GoogleJsonResponseException: API call to calendar.events.insert failed with error: Rate Limit Exceeded" on a fresh install from an Outlook calendar.

Update on my issue: it looks like subsequent syncs were able to get all the events in. maybe just a 1-time issue importing a large calendar for the first time?

@lyonsupe1
Copy link

Having the same usage limit exceeded issue with my calendar so I was wondering if this was figured out? I worked around it by just deleting the Google Calendar and creating a new one for it to sync, but that's obviously a temporary solution before it meets the threshold again.

@michaelh82
Copy link
Author

No, I've not heard anything back since my last message. However, my calendar seems to be syncing okay at the moment, so I never chased this up. I don't think the issue was fixed - I just think that the limit kept being hit originally as Google Calendar was trying to pull in years worth of events from Apple when I first set everything up. However, once everything was pulled in, it only needed to sync a few events a week, hence I have had no limit problems lately.

I have just logged into the Apps Script dashboard and looked at the executions, and there is still the odd 'Calendar usage limits exceeded' error popping up. But, I assume this is for some events in the past as everything I add to Apple Calendar shows in Google Calendar within 30 minutes, which is what the script is set to.

@Lonestarjeepin
Copy link
Collaborator

I realize this issue hasn't had a response in a while so I thought I would address it partially for posterity (in case others run across this), but also so I could close the Issue. From my understanding, there is almost nothing in the code that could "cause" this Limit issue. It's all on Google's side. However, there are a few issues with certain calendars and/or how the code handles them that can contribute to reaching that limit. First, if you have a calendar with a lot of events and you are running it for the first time, it's possible (a) the script might time out (b) it might trigger the google limit. In both of these cases, just let the script run for a few days and both issues will resolve themselves. Just having a calendar with a lot of events won't matter after the initial run because any events that don't change/add/delete just get skipped by the script and don't count against the Google Limit. Secondly, there is a Megathred #283 that addresses certain ics sources that regenerate a new event ID even if there have been no changes to a given event. This causes the script to see them as new events, adds them to the calendar, then delete the old event. This can also cause timeouts and limit thresholds to be exceeded. See that issue for a patch. Lastly, there was a situation where STATUS:CANCELLED events were getting added then immediately deleted by the script. That fix is now in the Master.

@michaelh82
Copy link
Author

Thanks @Lonestarjeepin for the update to this thread. I actually managed to find and solve this issue myself in the end, but totally forgot to update this thread (seeing your message has reminded me). The issue was caused because the script was, by default, leaving any past Apple events in Google Calendar which was eventually causing Google's limit to be reached. I simply updated the script to remove any Apple events that were in the past and this got rid of the issue by freeing up the space on Google's side.

For those that are unsure how to do this, you simply need to switch the below value from 'false' to 'true':

var onlyFutureEvents = true; // If you turn this to "true", past events will not be synced (this will also remove past events from the target calendar if removeEventsFromCalendar is true)

Once this is set to 'true' you should find that you receive no more usage limit errors. Hope this helps 😀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants