mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-15 12:17:20 +08:00
Fix: Reloader should exit when webui stop without setting event
This commit is contained in:
14
gui.py
14
gui.py
@@ -30,10 +30,18 @@ def func(ev: threading.Event):
|
|||||||
|
|
||||||
uvicorn.run(app, host=host, port=port, factory=True)
|
uvicorn.run(app, host=host, port=port, factory=True)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
while True:
|
should_exit = False
|
||||||
|
while not should_exit:
|
||||||
event = Event()
|
event = Event()
|
||||||
process = Process(target=func, args=(event,))
|
process = Process(target=func, args=(event,))
|
||||||
process.start()
|
process.start()
|
||||||
event.wait()
|
while not should_exit:
|
||||||
process.kill()
|
if event.wait(5):
|
||||||
|
process.kill()
|
||||||
|
break
|
||||||
|
elif process.is_alive():
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
should_exit = True
|
||||||
|
|||||||
Reference in New Issue
Block a user