You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(api): resolve startup race condition with initialization gate
Implements an initialization gate using a `Completer` in `bin/server.dart` to prevent a race condition where requests could be processed before asynchronous setup (DB connection, dependency injection) was complete.
- A new `_initializationGate` middleware now wraps the root handler.
- This middleware awaits a `Completer`'s future, effectively pausing all incoming requests.
- The completer is only marked as complete after all async initialization in `main()` is finished and the server is listening.
- This guarantees that the `DependencyContainer` is fully populated before any request attempts to access it, resolving the `LateInitializationError`.
0 commit comments