mirror of
https://github.com/vale981/emacs-jupyter
synced 2025-03-04 15:41:37 -05:00
jupyter-with-timeout: Don't spin wait so much
`accept-process-output` will return when any output has been read from a process (after it has been handled by the process filter function) which is usually the time when we want to check on the wait condition so there is no need to have such a low time resolution.
This commit is contained in:
parent
c0d13396bb
commit
cdc826259e
1 changed files with 7 additions and 3 deletions
|
@ -222,14 +222,18 @@ SPEC takes the form (PROGRESS SECONDS TIMEOUT-FORMS...).
|
|||
(declare (indent 1) (debug ((form form body) body)))
|
||||
(let ((res (make-symbol "res"))
|
||||
(prog (make-symbol "prog"))
|
||||
(prog-msg (make-symbol "prog-msg")))
|
||||
(prog-msg (make-symbol "prog-msg"))
|
||||
(timeout (make-symbol "timeout"))
|
||||
(wait-time (make-symbol "wait-time")))
|
||||
`(let* ((,res nil)
|
||||
(,prog-msg ,(pop spec))
|
||||
(,timeout ,(pop spec))
|
||||
(,wait-time (/ ,timeout 10.0))
|
||||
(,prog (and (stringp ,prog-msg)
|
||||
(make-progress-reporter ,prog-msg))))
|
||||
(with-timeout (,(pop spec) ,@spec)
|
||||
(with-timeout (,timeout ,@spec)
|
||||
(while (not (setq ,res (progn ,@wait-forms)))
|
||||
(accept-process-output nil 0.0001)
|
||||
(accept-process-output nil ,wait-time)
|
||||
(when ,prog (progress-reporter-update ,prog))))
|
||||
(prog1 ,res
|
||||
(when ,prog (progress-reporter-done ,prog))))))
|
||||
|
|
Loading…
Add table
Reference in a new issue