emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/emacsql a13eba5f05 059/427: Use the timeout argument in em


From: ELPA Syncer
Subject: [nongnu] elpa/emacsql a13eba5f05 059/427: Use the timeout argument in emacsql-wait.
Date: Tue, 13 Dec 2022 02:59:28 -0500 (EST)

branch: elpa/emacsql
commit a13eba5f05a03ae865f6e807f3a57c192b353b1c
Author: Christopher Wellons <wellons@nullprogram.com>
Commit: Christopher Wellons <wellons@nullprogram.com>

    Use the timeout argument in emacsql-wait.
---
 emacsql.el | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/emacsql.el b/emacsql.el
index 22f3d1e3ff..fb7e700120 100644
--- a/emacsql.el
+++ b/emacsql.el
@@ -209,8 +209,10 @@ buffer. This is for debugging purposes."
 
 (defun emacsql-wait (conn &optional timeout)
   "Block Emacs until CONN has finished sending output."
-  (while (not (emacsql--complete-p conn))
-    (accept-process-output (emacsql-process conn))))
+  (let ((end (when timeout (+ (float-time) timeout))))
+    (while (and (or (null timeout) (< (float-time) end))
+                (not (emacsql--complete-p conn)))
+      (accept-process-output (emacsql-process conn) timeout))))
 
 (defmacro emacsql-with-errors (conn &rest body)
   "Run BODY checking for errors from SQLite after completion."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]