async def notify_resource_available(self) -> None: # We currently need this to give plugins the chance to start as soon # as the `PeerPool` is available. In the long term, the peer pool may become # a plugin itself and we can get rid of this. peer_pool = self.get_peer_pool() await self.event_bus.broadcast( ResourceAvailableEvent(resource=(peer_pool, self.cancel_token), resource_type=type(peer_pool)), BroadcastConfig(internal=True), ) # This broadcasts the *local* chain, which is suited for tasks that aren't blocking # for too long. There may be value in also broadcasting the proxied chain. await self.event_bus.broadcast( ResourceAvailableEvent(resource=self.get_chain(), resource_type=BaseChain), BroadcastConfig(internal=True), ) # Broadcasting the DbManager internally, ensures plugins that run in the networking process # can reuse the existing connection instead of creating additional new connections await self.event_bus.broadcast( ResourceAvailableEvent(resource=self.db_manager, resource_type=BaseManager), BroadcastConfig(internal=True), )
def notify_resource_available(self) -> None: # We currently need this to give plugins the chance to start as soon # as the `PeerPool` is available. In the long term, the peer pool may become # a plugin itself and we can get rid of this. self._plugin_manager.broadcast( ResourceAvailableEvent(resource=(self.get_peer_pool(), self.cancel_token), resource_type=PeerPool)) # This broadcasts the *local* chain, which is suited for tasks that aren't blocking # for too long. There may be value in also broadcasting the proxied chain. self._plugin_manager.broadcast( ResourceAvailableEvent(resource=self.get_chain(), resource_type=BaseChain))