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

fix: panic with concurrent schema parsing #502

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

YousefHagag
Copy link

@YousefHagag YousefHagag commented Feb 10, 2025

Issue: #481

This pull request introduces a new test for concurrent schema parsing, adds a method to merge schema caches, and updates the schema parsing logic to utilize an internal cache. The most important changes are as follows:

Testing Enhancements:

  • concurrent_parse_test.go: Added a new test TestConcurrentParse to validate concurrent schema parsing by running multiple goroutines that parse a test schema. This ensures the thread-safety and correctness of the parsing function.

Schema Cache Enhancements:

  • schema.go: Added a new method AddAll to the SchemaCache struct, which allows merging all schemas from one cache into another. This is useful for combining schema caches without duplicating entries.

Schema Parsing Logic Enhancements:

  • schema_parse.go: Updated the ParseBytesWithCache function to use an internal SchemaCache for intermediate parsing steps. This change helps in isolating the parsing process and then merging the results back into the original cache, improving the modularity and maintainability of the code.

@YousefHagag YousefHagag changed the title Fix panic with concurrent schema parsing fix: panic with concurrent schema parsing Feb 10, 2025
schema_parse.go Outdated Show resolved Hide resolved
schema_parse.go Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants