Skip to content

Commit

Permalink
defer event bus initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
keotl committed May 28, 2023
1 parent 5a5eb69 commit 558e67d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions jivago/config/production_jivago_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,11 @@ def configure_service_locator(self):
self.serviceLocator.bind(PartialContentHandler, PartialContentHandler)
self.serviceLocator.bind(HttpStatusCodeResolver, HttpStatusCodeResolver)
self.serviceLocator.bind(ObjectMapper, ObjectMapper)
self.serviceLocator.bind(EventBus, self.create_event_bus())
self.serviceLocator.bind(SynchronousEventBus, self.serviceLocator.get(EventBus))
self.serviceLocator.bind(AsyncEventBus, AsyncEventBus(self.serviceLocator.get(EventBus)))
eventBusScope = SingletonScopeCache("_JivagoDependenciesSingleton", [EventBus, SynchronousEventBus, AsyncEventBus])
self.serviceLocator.register_scope(eventBusScope)
self.serviceLocator.bind(EventBus, self.create_event_bus)
self.serviceLocator.bind(SynchronousEventBus, SynchronousEventBus)
self.serviceLocator.bind(AsyncEventBus, AsyncEventBus)
self.serviceLocator.bind(RequestScopeCache, request_scope_cache)

if not self.banner:
Expand Down

0 comments on commit 558e67d

Please sign in to comment.