[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/hyperdrive f2474f65f0 08/49: Change: (-fill-version-ranges
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/hyperdrive f2474f65f0 08/49: Change: (-fill-version-ranges) In ELSE, send parallel requests |
Date: |
Wed, 20 Sep 2023 19:01:31 -0400 (EDT) |
branch: elpa/hyperdrive
commit f2474f65f048625e9ae42618357865758ce9f09c
Author: Joseph Turner <joseph@ushin.org>
Commit: Joseph Turner <joseph@ushin.org>
Change: (-fill-version-ranges) In ELSE, send parallel requests
When reaching a nonexistent entry, send parallel requests up to LIMIT.
Since nonexistent entries do not return a version range, each request
that returns a 404, only extends the nonexistent range by 1.
---
hyperdrive-lib.el | 44 +++++++++++++++++++++++++++-----------------
1 file changed, 27 insertions(+), 17 deletions(-)
diff --git a/hyperdrive-lib.el b/hyperdrive-lib.el
index de2991428f..faceaa7987 100644
--- a/hyperdrive-lib.el
+++ b/hyperdrive-lib.el
@@ -813,23 +813,33 @@ The QUEUE argument is used in recursive calls."
(unless queue
(setf queue (make-plz-queue :limit hyperdrive-queue-size
:finally (when finally finally))))
- (hyperdrive-fill (hyperdrive-copy-tree entry t)
- :then (lambda (filled-entry)
- (when (cl-plusp limit)
- ;; Don't use `hyperdrive-entry-previous' here, since it makes a
sync request
- (pcase-let ((`(,range-start . ,_plist)
(hyperdrive-entry-version-range filled-entry)))
- (setf (hyperdrive-entry-version filled-entry) (1- range-start))
- (when (eq 'unknown (hyperdrive-entry-exists-p filled-entry))
- ;; Recurse backward through history, filling unknown entries.
- ;; Stop recursing at known nonexistent entry or at the limit.
- (hyperdrive-fill-version-ranges filled-entry
- :limit (1- limit) :finally finally :queue queue)))))
- :else (lambda (err)
- (pcase (plz-response-status (plz-error-response err))
- ;; FIXME: If plz-error is a curl-error, this block will fail.
- (404 nil) ;; The loop stops if entry is not found, but don't
error
- (_ (signal (car err) (cdr err)))))
- :queue queue))
+ (let ((copy-entry (hyperdrive-copy-tree entry t)))
+ (hyperdrive-fill copy-entry
+ :then (lambda (filled-entry)
+ (when (cl-plusp limit)
+ ;; Don't use `hyperdrive-entry-previous' here, since it makes
a sync request
+ (pcase-let ((`(,range-start . ,_plist)
(hyperdrive-entry-version-range filled-entry)))
+ (setf (hyperdrive-entry-version filled-entry) (1-
range-start))
+ (when (eq 'unknown (hyperdrive-entry-exists-p filled-entry))
+ ;; Recurse backward through history, filling unknown
entries.
+ ;; Stop recursing at known nonexistent entry or at the
limit.
+ (hyperdrive-fill-version-ranges filled-entry
+ :limit (1- limit) :queue queue)))))
+ :else (lambda (err)
+ (pcase (plz-response-status (plz-error-response err))
+ ;; FIXME: If plz-error is a curl-error, this block will fail.
+ (404
+ ;; ENTRY is known nonexistent: send LIMIT number of
+ ;; parallel requests for entries before ENTRY's version.
+ (cl-dotimes (i limit)
+ (cl-decf (hyperdrive-entry-version copy-entry))
+ (unless (and (cl-plusp (hyperdrive-entry-version
copy-entry))
+ (eq 'unknown (hyperdrive-entry-exists-p
copy-entry)))
+ (cl-return))
+ (hyperdrive-fill-version-ranges copy-entry
+ :limit 0 :queue queue)))
+ (_ (signal (car err) (cdr err)))))
+ :queue queue)))
(defun hyperdrive-fill-metadata (hyperdrive)
"Fill HYPERDRIVE's public metadata and return it.
- [nongnu] elpa/hyperdrive 3ea4e934db 24/49: Change: (hyperdrive-open) Use hyperdrive-message, (continued)
- [nongnu] elpa/hyperdrive 3ea4e934db 24/49: Change: (hyperdrive-open) Use hyperdrive-message, ELPA Syncer, 2023/09/20
- [nongnu] elpa/hyperdrive 395d1dd5e0 25/49: Fix: (-fill-version-ranges) Stop filling when loop returns early, ELPA Syncer, 2023/09/20
- [nongnu] elpa/hyperdrive 8dc8f09a82 30/49: Comment: Add TODO, ELPA Syncer, 2023/09/20
- [nongnu] elpa/hyperdrive 77186465d7 33/49: WIP: Fixes, ELPA Syncer, 2023/09/20
- [nongnu] elpa/hyperdrive 1844b57f51 39/49: Fix: (-update-nonexistent-version-range) Add default finally, ELPA Syncer, 2023/09/20
- [nongnu] elpa/hyperdrive 44413406c9 40/49: Change: (-history-fill-version-ranges) Add loading indicator, ELPA Syncer, 2023/09/20
- [nongnu] elpa/hyperdrive e2ddaa770c 01/49: Change: (hyperdrive-fill-version-ranges) Only recurse from ENTRY, ELPA Syncer, 2023/09/20
- [nongnu] elpa/hyperdrive 509f72b4f0 02/49: Change: (hyperdrive-history) Display history buffer immediately, ELPA Syncer, 2023/09/20
- [nongnu] elpa/hyperdrive d93ab84313 06/49: Meta: Update changelog, ELPA Syncer, 2023/09/20
- [nongnu] elpa/hyperdrive 32580aaa6c 07/49: Docs: Document hyperdrive-fill-version-ranges-limit, ELPA Syncer, 2023/09/20
- [nongnu] elpa/hyperdrive f2474f65f0 08/49: Change: (-fill-version-ranges) In ELSE, send parallel requests,
ELPA Syncer <=
- [nongnu] elpa/hyperdrive 063c2275d1 09/49: WIP: (-fill-version-ranges) Fill existent and nonexistent ranges, ELPA Syncer, 2023/09/20
- [nongnu] elpa/hyperdrive 73cef39917 12/49: WIP: Fix off-by-one, ELPA Syncer, 2023/09/20
- [nongnu] elpa/hyperdrive 05a0421bbb 16/49: Change: (hyperdrive-fill-version-ranges) Use finishedp flag, ELPA Syncer, 2023/09/20
- [nongnu] elpa/hyperdrive cb91f4adac 03/49: Add: (-history-fill-version-ranges) Interactively fill versions, ELPA Syncer, 2023/09/20
- [nongnu] elpa/hyperdrive 2c8a76234d 20/49: Tidy: (-fill-version-ranges) Rename queue to fill-entry-queue, ELPA Syncer, 2023/09/20
- [nongnu] elpa/hyperdrive 830904c5cf 22/49: Comment: Remove TODO, ELPA Syncer, 2023/09/20
- [nongnu] elpa/hyperdrive 92a54cb93c 23/49: Fix: (hyperdrive-update-nonexistent-version-range) Docstring, ELPA Syncer, 2023/09/20
- [nongnu] elpa/hyperdrive 53b48e337e 27/49: Tidy: (hyperdrive-fill-version-ranges) Don't let-bind finally, ELPA Syncer, 2023/09/20
- [nongnu] elpa/hyperdrive 46490c55a2 26/49: Tidy: (-fill-version-ranges) Return nil from cl-dotimes for clarity, ELPA Syncer, 2023/09/20
- [nongnu] elpa/hyperdrive 758486bcdd 28/49: Change: Rename hyperdrive-queue-size to hyperdrive-queue-limit, ELPA Syncer, 2023/09/20