Browse Source

Nicely stop async event loop for modguis

Signed-off-by: falkTX <falktx@falktx.com>
tags/v2.2.0-RC1
falkTX 4 years ago
parent
commit
b87e0107c4
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      source/frontend/modgui/webserver.py

+ 5
- 1
source/frontend/modgui/webserver.py View File

@@ -203,12 +203,14 @@ class WebServerThread(QThread):
debug=True)

self.fPrepareWasCalled = False
self.fEventLoop = None

def run(self):
if not self.fPrepareWasCalled:
self.fPrepareWasCalled = True
if haveAsyncIO:
set_event_loop(new_event_loop())
self.fEventLoop = new_event_loop()
set_event_loop(self.fEventLoop)
self.fApplication.listen(PORT, address="0.0.0.0")
if int(os.getenv("MOD_LOG", "0")):
enable_pretty_logging()
@@ -218,4 +220,6 @@ class WebServerThread(QThread):

def stopWait(self):
IOLoop.instance().stop()
if self.fEventLoop is not None:
self.fEventLoop.call_soon_threadsafe(self.fEventLoop.stop)
return self.wait(5000)

Loading…
Cancel
Save