mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-04 13:20:17 +00:00
Fix khoj--server-running to work with unconfigured or external server
- If khoj server started outside emacs, khoj--server-ready should be set to true by khoj--server-running method (instead of waiting for proc msg) - If khoj server is unconfigured the /config/types endpoint wouldn't return anything. Using config/data/default allows checking khoj server running status without requiring it to be configured as well
This commit is contained in:
@@ -281,13 +281,14 @@ for example), set this to the full interpreter path."
|
||||
|
||||
(defun khoj--server-running? ()
|
||||
"Check if the khoj server is running."
|
||||
(or
|
||||
;; check for when server process handled from within emacs
|
||||
(and khoj--server-process
|
||||
(not (null (process-live-p khoj--server-process))))
|
||||
;; else general check via ping to khoj-server-url
|
||||
(ignore-errors
|
||||
(not (null (khoj--get-enabled-content-types) t)))))
|
||||
(when (or
|
||||
;; check for when server process handled from within emacs
|
||||
(and khoj--server-process
|
||||
(not (null (process-live-p khoj--server-process))))
|
||||
;; else general check via ping to khoj-server-url
|
||||
(ignore-errors
|
||||
(not (null (url-retrieve-synchronously (format "%s/api/config/data/default" khoj-server-url))))))
|
||||
(setq khoj--server-ready? t)))
|
||||
|
||||
(defun khoj--server-stop ()
|
||||
"Stop the khoj server."
|
||||
|
||||
Reference in New Issue
Block a user