diff mbox series

[bug#39873,2/3] substitute: Make http-multiple-get batch size configurable.

Message ID 20200302210735.13337-2-mail@cbaines.net
State Accepted
Headers show
Series http-multiple-get enhancements | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job

Commit Message

Christopher Baines March 2, 2020, 9:07 p.m. UTC
* guix/scripts/substitute.scm (http-multiple-get): Add batch-size parameter.
---
 guix/scripts/substitute.scm | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Ludovic Courtès March 7, 2020, 9:13 p.m. UTC | #1
Christopher Baines <mail@cbaines.net> skribis:

> * guix/scripts/substitute.scm (http-multiple-get): Add batch-size parameter.

LGTM!
diff mbox series

Patch

diff --git a/guix/scripts/substitute.scm b/guix/scripts/substitute.scm
index 5ed43d36c9..a88cb5bcfe 100755
--- a/guix/scripts/substitute.scm
+++ b/guix/scripts/substitute.scm
@@ -501,7 +501,8 @@  MAX-LENGTH first elements."
            (loop (+ 1 len) tail (cons head result)))))))
 
 (define* (http-multiple-get base-uri proc seed requests
-                            #:key port (verify-certificate? #t))
+                            #:key port (verify-certificate? #t)
+                            (batch-size 1000))
   "Send all of REQUESTS to the server at BASE-URI.  Call PROC for each
 response, passing it the request object, the response, a port from which to
 read the response body, and the previous result, starting with SEED, à la
@@ -511,7 +512,7 @@  initial connection on which HTTP requests are sent."
                 (requests requests)
                 (result   seed))
     (define batch
-      (at-most 1000 requests))
+      (at-most batch-size requests))
 
     ;; (format (current-error-port) "connecting (~a requests left)..."
     ;;         (length requests))