branch: elpa/aidermacs
commit cdee470ee5aa5c81364799fa46f9dbd5ef588663
Author: Yikai Zhao <yi...@z1k.dev>
Commit: Matthew Zeng <matthew...@gmail.com>

    Wait for a bit longer time for the backend to be ready
---
 aidermacs.el | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/aidermacs.el b/aidermacs.el
index c4665dfe879..87812abae6b 100644
--- a/aidermacs.el
+++ b/aidermacs.el
@@ -488,9 +488,11 @@ If CALLBACK is non-nil it will be called after the command 
finishes."
          (processed-command (aidermacs--process-message-if-multi-line 
command)))
     ;; Check if command may edit files and prepare accordingly
     (with-current-buffer buffer
-      ;; Attempt to wait out transient commands or server lag
-      (when (not aidermacs--ready)
-        (sit-for 0.5))
+      ;; Attempt to wait out transient commands or server lag for max 3s
+      (let ((max-wait-count 30))
+        (while (and (not aidermacs--ready) (> max-wait-count 0))
+          (sit-for 0.1)
+          (setq max-wait-count (1- max-wait-count))))
       (if (not aidermacs--ready)
           (progn (aidermacs-switch-to-buffer buffer-name)
                  (message "Aider process is not currently accepting commands"))

Reply via email to