mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-23 15:38:55 +01:00
Pass a SIGTERM to tell the uvicorn server to exit and gracefully kill the thread
This commit is contained in:
parent
34d5cd2bd8
commit
4fb8c2c5e1
2 changed files with 7 additions and 1 deletions
|
@ -1,5 +1,7 @@
|
|||
# Standard Packages
|
||||
import webbrowser
|
||||
import os
|
||||
import signal
|
||||
|
||||
# External Packages
|
||||
from PySide6 import QtGui, QtWidgets
|
||||
|
@ -21,6 +23,10 @@ class ServerThread(QThread):
|
|||
def run(self):
|
||||
self.start_server_func()
|
||||
|
||||
def exit(self):
|
||||
os.kill(os.getpid(), signal.SIGTERM)
|
||||
super(ServerThread, self).exit()
|
||||
|
||||
|
||||
class MainWindow(QtWidgets.QMainWindow):
|
||||
"""Create Window to Navigate users to the web UI"""
|
||||
|
|
|
@ -123,7 +123,7 @@ def run():
|
|||
|
||||
# Start Application
|
||||
server.start()
|
||||
gui.aboutToQuit.connect(server.terminate)
|
||||
gui.aboutToQuit.connect(server.exit)
|
||||
|
||||
# Close Splash Screen if still open
|
||||
if system() != "Darwin":
|
||||
|
|
Loading…
Reference in a new issue