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

Skip on 5xx and 4xx URL errors #392

Closed
wants to merge 1 commit into from
Closed

Conversation

Lonestarjeepin
Copy link
Collaborator

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.

@Lonestarjeepin Lonestarjeepin linked an issue Dec 15, 2023 that may be closed by this pull request
@Lonestarjeepin Lonestarjeepin mentioned this pull request Dec 22, 2023
@@ -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...");
Copy link
Contributor

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)

Copy link
Collaborator Author

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.

Copy link
Contributor

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

@Lonestarjeepin
Copy link
Collaborator Author

Closing PR as #403 is more robust solution.

@jonas0b1011001 jonas0b1011001 deleted the 5xx_and_4xx_errors branch May 17, 2024 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Events removed when URL returns 5xx Error, Retrying...Exception: Address unavailable
2 participants