-
-
Notifications
You must be signed in to change notification settings - Fork 209
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
Skip on 5xx and 4xx URL errors #392
Conversation
@@ -174,6 +174,11 @@ function startSync(){ | |||
|
|||
//------------------------ Fetch URL items ------------------------ | |||
var responses = fetchSourceCalendars(sourceCalendarURLs); | |||
//Skip the source calendar if a 5xx or 4xx error is returned. This prevents deleting all of the existing entries if the URL call fails. | |||
if (responses.length == 0){ | |||
Logger.log("Error Syncing " + sourceCalendarName + ". Skipping..."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm uncomfortable with this solution. Instead of a conspicuously missing calendar, we end up with a wrong calendar that appears to be correct (because it is merely outdated).
See discussion in #343 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@octogonz I agree that having a stale calendar isn't great, but I don't want to miss meetings/events because they are absent from my calendar. In the issue thread, it sounds like you are on the path toward a good solution though. It seems like it would be good to skip the unreachable calendar (don't delete the events) either for a certain amount of time or certain number of retries/runs of the code, but then after that threshold is reached, send an email to let the user know that calendar is unresponsive. Sounds like the best of both worlds. In some separate code I'm working on, I've used this "PropertiesService.getUserProperties().setProperty(xyz);" to store information that persists across runs (I think of it like a cookie). This PropertiesService could hold the number of consecutive failures to be used in the threshold.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Compare with this approach: #403
Closing PR as #403 is more robust solution. |
For transparency, this is purely a PR from the code @jerrywoo96 wrote to fix #343 . I'm just turning it into a PR so it can get merged eventually.