Fix infinite loop in calendar recurrence expansion#39
Merged
karolswdev merged 1 commit intomainfrom Mar 30, 2026
Merged
Conversation
expandBiweekly and expandWeekly could spin forever when day_of_week was null/undefined (e.g., admin creates a weekly entry without picking a day). The while loop condition `anchor.getDay() !== null` is always true, blocking the Node event loop and causing 504s on all endpoints. Added null guards to all expansion functions so they bail out early when required recurrence fields are missing.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
HOTFIX — Production 504s
The
expandBiweekly()function has an infinite loop whenday_of_weekisnull. The conditionwhile (anchor.getDay() !== null)never terminates becausegetDay()returns 0-6, nevernull. This blocks the Node event loop and causes all endpoints to 504.Triggered when an admin creates a weekly/biweekly calendar entry without selecting a day of the week.
Fix
Added null guards to
expandWeekly,expandBiweekly, andexpandMonthly— they return early if required recurrence fields are missing.Test plan
/api/calendarresponds correctly🤖 Generated with Claude Code