mirror of
https://github.com/LmeSzinc/AzurLaneAutoScript.git
synced 2025-01-08 13:07:33 +08:00
Fix: Reloader should exit when webui stop without setting event
This commit is contained in:
parent
d7d440a29e
commit
97302ff8a2
14
gui.py
14
gui.py
@ -30,10 +30,18 @@ def func(ev: threading.Event):
|
||||
|
||||
uvicorn.run(app, host=host, port=port, factory=True)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
while True:
|
||||
should_exit = False
|
||||
while not should_exit:
|
||||
event = Event()
|
||||
process = Process(target=func, args=(event,))
|
||||
process.start()
|
||||
event.wait()
|
||||
process.kill()
|
||||
while not should_exit:
|
||||
if event.wait(5):
|
||||
process.kill()
|
||||
break
|
||||
elif process.is_alive():
|
||||
continue
|
||||
else:
|
||||
should_exit = True
|
||||
|
Loading…
Reference in New Issue
Block a user