Skip to content

Prevent running validate_* functions twice #629

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

Merged
merged 2 commits into from
Apr 15, 2025

Conversation

meleu
Copy link
Collaborator

@meleu meleu commented Apr 14, 2025

Currently a validation function runs twice:

  1. for actually validating
  2. only to generate the error message

If validation happens to perform a costly computation, this can be slow and a waste of resources.

This MR makes the validation functions run only once, and then use its output for both validation and error message.

@meleu meleu requested a review from DannyBen April 14, 2025 18:40
DannyBen
DannyBen previously approved these changes Apr 14, 2025
Copy link
Member

@DannyBen DannyBen left a comment

Choose a reason for hiding this comment

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

Looks good. I will check it locally tomorrow and merge.
Thanks.

@DannyBen DannyBen added this to the 1.2.12 milestone Apr 14, 2025
@DannyBen DannyBen merged commit a3075a0 into master Apr 15, 2025
8 checks passed
@DannyBen DannyBen deleted the prevent-running-validate-twice branch April 15, 2025 07:30
@DannyBen
Copy link
Member

DannyBen commented May 2, 2025

This is released now in v1.2.12.

meleu added a commit that referenced this pull request Aug 3, 2025
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