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

Init schemas during module initialization #18

Merged
merged 2 commits into from
Dec 8, 2023

Conversation

m-kusnierz
Copy link
Contributor

Delayed schema initialization negatively impacts processing time of the first requests that use schema validation.

This PR initializes the schemas during module initialization - this will increase the startup time of application requiring this module, but this is preferred behaviour instead of increased response time of the first requests.

Comment on lines +19 to +21
var validateSchema = getValidateSchemaInstance();
var filterSchema = getFilterSchemaInstance();
var validateSchemaNoReadonly = getValidateSchemaNoReadonlyInstance();
Copy link
Member

Choose a reason for hiding this comment

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

Should we replace all this with const finally? 🙂

Copy link
Member

Choose a reason for hiding this comment

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

Might be a good opportunity to give the library a slight overhaul and update.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I almost did it here 😄 But I will make a new refactoring PR

@m-kusnierz m-kusnierz merged commit 156fa31 into master Dec 8, 2023
@m-kusnierz m-kusnierz deleted the optimize/early-init-schemas branch December 8, 2023 08:44
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.

3 participants