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

Use StopIteration instead of invariant in schedule iterator #27936

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

sbquinlan
Copy link
Member

@sbquinlan sbquinlan commented Feb 20, 2025

Summary & Motivation

It's possible for invalid cron schedules to throw an invariant of the iterator, which breaks places that only expected StopIteration. This PR changes the handling of invalid crons from throwing an invariant violation to yielding nothing from the iterator. I updated the calling code as well to handle StopIteration in both branches (there's only one branch now).

How I Tested These Changes

bk

Copy link
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@sbquinlan sbquinlan requested a review from gibsondan February 20, 2025 17:29
Copy link
Member

@gibsondan gibsondan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if we made futureTicks a graphene.Field instead of a graphene.NonNull it would do something similar in that an error would just null out that field instead of nuking the whole query? If we did that we might have to adjust the JS callsites to account for the null case (the build would likely fail until we did that)

Comment on lines +160 to +161
# If the schedule is not valid, we will return an empty list
pass
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should add a logging.exception call if we do this so we know what the error was

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.

2 participants