mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-04 21:29:12 +00:00
Attach the parent to the server thread, allowing the kill signal to trigger a graceful exit (#446)
This commit is contained in:
@@ -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}")
|
||||
|
||||
Reference in New Issue
Block a user