mirror of
https://github.com/vale981/emacs-jupyter
synced 2025-03-04 15:41:37 -05:00
jupyter-handle-message: Drop idle messages less frequently
This accounts for idle messages being dropped before a request's reply message. In such a case, the request is dropped from the client's request table before the handlers/callbacks of the request get a chance to handle the reply message.
This commit is contained in:
parent
b7a7c31422
commit
a4d95aab80
2 changed files with 8 additions and 11 deletions
|
@ -697,8 +697,12 @@ are taken:
|
|||
;; consider REQ as having received an idle message in
|
||||
;; this case.
|
||||
(eq (jupyter-message-type msg) :shutdown-reply))
|
||||
(setf (jupyter-request-idle-received-p req) t))
|
||||
(jupyter--drop-idle-requests client)))))))
|
||||
;; Order matters here. We want to remove idle requests *before*
|
||||
;; setting another request idle to account for idle messages
|
||||
;; coming in out of order, e.g. before their respective reply
|
||||
;; messages.
|
||||
(jupyter--drop-idle-requests client)
|
||||
(setf (jupyter-request-idle-received-p req) t))))))))
|
||||
|
||||
;;; Channel handler macros
|
||||
|
||||
|
|
|
@ -1707,15 +1707,8 @@ Return the buffer switched to."
|
|||
;; ring.
|
||||
(ring-insert jupyter-repl-history 'jupyter-repl-history)
|
||||
(let ((jupyter-inhibit-handlers '(:status)))
|
||||
;; Wait until we get an idle response since the call to
|
||||
;; `jupyter-repl-sync-execution-state' below will be considered the last
|
||||
;; request the client made. If an idle message for this history request
|
||||
;; is received before the reply, the reply message won't ever be
|
||||
;; received since the idle message will cause the request to be dropped
|
||||
;; if the request isn't the last request the client made.
|
||||
(jupyter-wait-until-idle
|
||||
(jupyter-send-history-request jupyter-current-client
|
||||
:n jupyter-repl-history-maximum-length :raw nil :unique t)))
|
||||
(jupyter-send-history-request jupyter-current-client
|
||||
:n jupyter-repl-history-maximum-length :raw nil :unique t))
|
||||
(erase-buffer)
|
||||
;; Add local hooks
|
||||
(add-hook 'kill-buffer-query-functions #'jupyter-repl-kill-buffer-query-function nil t)
|
||||
|
|
Loading…
Add table
Reference in a new issue