branch: externals/eglot
commit 7769c07cba9d66522e6cc45f93ea15215f96ae5f
Author: João Távora <joaotav...@gmail.com>
Commit: João Távora <joaotav...@gmail.com>

    Send message, then establish continuations
    
    This way, if serializing fails, or something else, we won't be
    bothered by the failing timeout.
    
    * jrpc.el (jrpc-async-request): Send, then establish continuations.
---
 jrpc.el | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/jrpc.el b/jrpc.el
index 7303414..bb4fe28 100644
--- a/jrpc.el
+++ b/jrpc.el
@@ -558,8 +558,12 @@ Return the request ID, or nil, in case the request was 
deferred."
             (puthash (list deferred buf) (list later (funcall make-timeout))
                      (jrpc--deferred-actions proc))
             (cl-return-from jrpc-async-request nil)))))
-    ;; Really run it
+    ;; Really send it
     ;;
+    (jrpc--process-send proc (jrpc-obj :jsonrpc "2.0"
+                                       :id id
+                                       :method method
+                                       :params params))
     (puthash id
              (list (or success-fn
                        (jrpc-lambda (&rest _ignored)
@@ -573,10 +577,6 @@ Return the request ID, or nil, in case the request was 
deferred."
                                          :id id :error code))))
                    (funcall make-timeout))
              (jrpc--request-continuations proc))
-    (jrpc--process-send proc (jrpc-obj :jsonrpc "2.0"
-                                       :id id
-                                       :method method
-                                       :params params))
     id))
 
 (cl-defun jrpc-request (proc method params &key deferred)

Reply via email to