mirror of
https://github.com/khoj-ai/khoj.git
synced 2024-11-23 23:48:56 +01:00
Attach the parent to the server thread, allowing the kill signal to trigger a graceful exit (#446)
This commit is contained in:
parent
3c58ab5fcb
commit
4e03dfea43
2 changed files with 3 additions and 3 deletions
|
@ -11,8 +11,8 @@ from PySide6.QtCore import QThread
|
|||
|
||||
|
||||
class ServerThread(QThread):
|
||||
def __init__(self, start_server_func):
|
||||
super(ServerThread, self).__init__()
|
||||
def __init__(self, start_server_func, parent=None):
|
||||
super(ServerThread, self).__init__(parent)
|
||||
self.start_server_func = start_server_func
|
||||
|
||||
def __del__(self):
|
||||
|
|
|
@ -100,7 +100,7 @@ def run():
|
|||
# Setup Server
|
||||
initialize_server(args.config, args.regenerate, required=False)
|
||||
configure_routes(app)
|
||||
server = ServerThread(start_server_func=lambda: start_server(app, host=args.host, port=args.port))
|
||||
server = ServerThread(start_server_func=lambda: start_server(app, host=args.host, port=args.port), parent=gui)
|
||||
|
||||
url = f"http://{args.host}:{args.port}"
|
||||
logger.info(f"🌗 Khoj is running at {url}")
|
||||
|
|
Loading…
Reference in a new issue