[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/plz 71e36fe27b 2/9: Fix: (plz-run) Only call queue's FI
From: |
ELPA Syncer |
Subject: |
[elpa] externals/plz 71e36fe27b 2/9: Fix: (plz-run) Only call queue's FINALLY when specified |
Date: |
Sat, 15 Apr 2023 18:59:05 -0400 (EDT) |
branch: externals/plz
commit 71e36fe27b4af04a3413ded4f570a361613deb71
Author: Adam Porter <adam@alphapapa.net>
Commit: Adam Porter <adam@alphapapa.net>
Fix: (plz-run) Only call queue's FINALLY when specified
---
README.org | 3 ++-
plz.el | 3 ++-
plz.info | 23 ++++++++++++-----------
tests/test-plz.el | 22 +++++++++++++++++++++-
4 files changed, 37 insertions(+), 14 deletions(-)
diff --git a/README.org b/README.org
index 0c808d1509..b873774854 100644
--- a/README.org
+++ b/README.org
@@ -175,7 +175,8 @@ You may also clear a queue with ~plz-clear~, which cancels
any active or queued
** 0.5.1-pre
-Nothing new yet.
+*Fixes*
++ Only call ~plz-queue~'s ~finally~ function when specified. (Thanks to
[[https://github.com/redchops][Dan Oriani]] for reporting.)
** 0.5
diff --git a/plz.el b/plz.el
index da4c697d92..cd45ca63be 100644
--- a/plz.el
+++ b/plz.el
@@ -620,7 +620,8 @@ QUEUE should be a `plz-queue' structure."
(setf args (plist-put args :timeout timeout)))
(setf (plz-queued-request-process request) (apply #'plz args))
(push request (plz-queue-active queue))))
- (funcall (plz-queue-finally queue))
+ (when (plz-queue-finally queue)
+ (funcall (plz-queue-finally queue)))
queue))
(defun plz-clear (queue)
diff --git a/plz.info b/plz.info
index c888eab541..ed3a591413 100644
--- a/plz.info
+++ b/plz.info
@@ -286,7 +286,8 @@ File: README.info, Node: 051-pre, Next: 05, Up: Changelog
3.1 0.5.1-pre
=============
-Nothing new yet.
+*Fixes*
+ • Only call ‘plz-queue’’s ‘finally’ function when specified.
File: README.info, Node: 05, Next: 04, Prev: 051-pre, Up: Changelog
@@ -432,16 +433,16 @@ Node: Queueing6681
Node: Tips7939
Node: Changelog8240
Node: 051-pre8445
-Node: 058556
-Node: 048766
-Node: 039672
-Node: 02110120
-Node: 0210269
-Node: 0110398
-Node: Credits10492
-Node: Development10858
-Node: Copyright assignment11372
-Node: License11960
+Node: 058623
+Node: 048833
+Node: 039739
+Node: 02110187
+Node: 0210336
+Node: 0110465
+Node: Credits10559
+Node: Development10925
+Node: Copyright assignment11439
+Node: License12027
End Tag Table
diff --git a/tests/test-plz.el b/tests/test-plz.el
index 6c06ef03dc..2d32ae6115 100644
--- a/tests/test-plz.el
+++ b/tests/test-plz.el
@@ -507,7 +507,8 @@
;; TODO: Test that limit is enforced (though it seems to work fine).
-(plz-deftest plz-queue ()
+(plz-deftest plz-queue-with-finally ()
+ "Ensure that a queue with a FINALLY function calls it when done."
(let* ((finally-called nil)
(queue (make-plz-queue :limit 2
:finally (lambda ()
@@ -529,6 +530,25 @@
(zerop (plz-length queue))
finally-called)))
+(plz-deftest plz-queue-without-finally ()
+ "Ensure that a queue without a FINALLY function doesn't signal an error."
+ (let* ((queue (make-plz-queue :limit 2))
+ (urls '("https://httpbin.org/get?foo=0"
+ "https://httpbin.org/get?foo=1"))
+ completed-urls)
+ (dolist (url urls)
+ (plz-queue queue
+ 'get url :then (lambda (_)
+ (push url completed-urls))))
+ (plz-run queue)
+ (cl-loop with waits = 0
+ while (and (plz-queue-active queue) (< waits 20))
+ do (progn
+ (sleep-for 0.1)
+ (cl-incf waits)))
+ (and (seq-set-equal-p urls completed-urls)
+ (zerop (plz-length queue)))))
+
;; TODO: Add test for canceling queue.
;;;; Footer
- [elpa] externals/plz updated (fc8159a6a9 -> 7ea6175f2c), ELPA Syncer, 2023/04/15
- [elpa] externals/plz 6e52fbc9f9 3/9: Release: v0.5.1, ELPA Syncer, 2023/04/15
- [elpa] externals/plz c471f64bda 4/9: Meta: v0.5.2-pre, ELPA Syncer, 2023/04/15
- [elpa] externals/plz 0a85c01776 1/9: Meta: v0.5.1-pre, ELPA Syncer, 2023/04/15
- [elpa] externals/plz 71e36fe27b 2/9: Fix: (plz-run) Only call queue's FINALLY when specified,
ELPA Syncer <=
- [elpa] externals/plz fd2141814d 5/9: Fix: (plz-clear) Only run queue's FINALLY when specified, ELPA Syncer, 2023/04/15
- [elpa] externals/plz 973050f224 8/9: Fix: (plz-queue) Move new slot to end, ELPA Syncer, 2023/04/15
- [elpa] externals/plz 7ea6175f2c 9/9: Release: v0.5.3, ELPA Syncer, 2023/04/15
- [elpa] externals/plz 3b9b886cca 6/9: Release: v0.5.2, ELPA Syncer, 2023/04/15
- [elpa] externals/plz 2bddc47085 7/9: Meta: v0.5.3-pre, ELPA Syncer, 2023/04/15