File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -482,7 +482,8 @@ async def start(self) -> None:
482482 async def stop (self , timeout = 1.0 ):
483483 """Stop the agent."""
484484 # notify protcols that we are shutting down
485- await self .root_profile .notify (SHUTDOWN_EVENT_TOPIC , {})
485+ if self .root_profile :
486+ await self .root_profile .notify (SHUTDOWN_EVENT_TOPIC , {})
486487
487488 shutdown = TaskQueue ()
488489 if self .dispatcher :
@@ -494,13 +495,13 @@ async def stop(self, timeout=1.0):
494495 if self .outbound_transport_manager :
495496 shutdown .run (self .outbound_transport_manager .stop ())
496497
497- # close multitenant profiles
498- multitenant_mgr = self .context .inject_or (BaseMultitenantManager )
499- if multitenant_mgr :
500- for profile in multitenant_mgr .open_profiles :
501- shutdown .run (profile .close ())
502-
503498 if self .root_profile :
499+ # close multitenant profiles
500+ multitenant_mgr = self .context .inject_or (BaseMultitenantManager )
501+ if multitenant_mgr :
502+ for profile in multitenant_mgr .open_profiles :
503+ shutdown .run (profile .close ())
504+
504505 shutdown .run (self .root_profile .close ())
505506
506507 await shutdown .complete (timeout )
You can’t perform that action at this time.
0 commit comments