Explorar o código

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

Falko Schindler %!s(int64=2) %!d(string=hai) anos
pai
achega
8d11d747f4
Modificáronse 1 ficheiros con 2 adicións e 0 borrados
  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