Procházet zdrojové kódy

raise exception when ui.shutdown is called with auto-reload activated

Falko Schindler před 2 roky
rodič
revize
8d11d747f4
1 změnil soubory, kde provedl 2 přidání a 0 odebrání
  1. 2 0
      nicegui/lifecycle.py

+ 2 - 0
nicegui/lifecycle.py

@@ -22,6 +22,8 @@ def on_shutdown(self, handler: Union[Callable, Awaitable]):
 
 
 async def shutdown(self) -> None:
+    if globals.config.reload:
+        raise Exception('ui.shutdown is not supported when auto-reload is enabled')
     for socket in [s for page in jp.WebPage.sockets.values() for s in page.values()]:
         await socket.close()
     globals.server.should_exit = True