소스 검색

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

Falko Schindler 2 년 전
부모
커밋
8d11d747f4
1개의 변경된 파일2개의 추가작업 그리고 0개의 파일을 삭제
  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