File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -98,7 +98,7 @@ def _prepare(self) -> None:
9898
9999 self .log .info (f"Initializing { self .name } { self .version } " )
100100 try :
101- self .prepare ( )
101+ self .loop . run_until_complete ( self . _async_prepare () )
102102 except Exception :
103103 self .log .critical ("Unexpected error in initialization" , exc_info = True )
104104 sys .exit (1 )
@@ -117,6 +117,7 @@ def preinit(self) -> None:
117117 self .prepare_config ()
118118 self .prepare_log ()
119119 self .check_config ()
120+ self .init_loop ()
120121
121122 @property
122123 def base_config_path (self ) -> str :
@@ -168,14 +169,16 @@ def prepare_log(self) -> None:
168169 logging .config .dictConfig (copy .deepcopy (self .config ["logging" ]))
169170 self .log = cast (TraceLogger , logging .getLogger ("mau.init" ))
170171
172+ async def _async_prepare (self ) -> None :
173+ self .prepare ()
174+
171175 def prepare (self ) -> None :
172176 """
173177 Lifecycle method where the primary program initialization happens.
174178 Use this to fill startup_actions with async startup tasks.
175179 """
176- self .prepare_loop ()
177180
178- def prepare_loop (self ) -> None :
181+ def init_loop (self ) -> None :
179182 """Init lifecycle method where the asyncio event loop is created."""
180183 if uvloop is not None :
181184 uvloop .install ()
You can’t perform that action at this time.
0 commit comments