fix(bootstrap): ensure bootstrap runs only once for concurrent requests#833
Draft
furelid wants to merge 1 commit into
Draft
fix(bootstrap): ensure bootstrap runs only once for concurrent requests#833furelid wants to merge 1 commit into
furelid wants to merge 1 commit into
Conversation
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.
Description
This pull request improves the reliability of the bootstrap process in the middleware by ensuring that system initialization is only executed once, even under concurrent cold-start requests. It introduces a mechanism to prevent duplicate bootstrap runs, adds a comprehensive test for concurrency, and updates the reset logic to support repeated testing.
These changes make the bootstrap process more robust and the tests more reliable.
Fixes: not applicable, improvementqq 1
Changes
Concurrency handling and bootstrap logic:
bootstrapInFlightpromise to the bootstrap middleware inbootstrap.tsto ensure that concurrent requests during cold start will wait for the same initialization process, preventing multiple bootstrap executions. Q[1] [2] [3]resetBootstrapfunction to clear bothbootstrapCompleteandbootstrapInFlight, ensuring tests and future requests start with a clean state.Testing
bootstrap.test.tsto verify that concurrent cold-start requests only trigger a single bootstrap run, and that all dependent services are only called once.resetBootstraptest suite for better isolation.syncAllFormCollectionsservice and imported it for use in assertions. [1] [2]Unit Tests
E2E Tests
Screenshots/Videos
Checklist
Generated with Claude Code in Conductor