diff options
author | Christopher Baines <mail@cbaines.net> | 2023-10-17 18:00:01 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2023-10-17 18:00:01 +0100 |
commit | b1f477e8138c557e3a7977ad76692623c9000e8f (patch) | |
tree | 8ca3a7f4ef1c74d9f2426861a70bff016a786705 /guix-qa-frontpage/manage-patch-branches.scm | |
parent | 9621f0ab61c4f2de1e613095db0f130a912b0f93 (diff) | |
download | qa-frontpage-b1f477e8138c557e3a7977ad76692623c9000e8f.tar qa-frontpage-b1f477e8138c557e3a7977ad76692623c9000e8f.tar.gz |
Refactor fetching data from patchwork
Fetch pages one at a time until the required number of patch series has been
fetched.
This commit also changes the ordering from issue number to the series ID,
which will mean that series associated with older issues will be prefered over
newer issues with older series.
Diffstat (limited to 'guix-qa-frontpage/manage-patch-branches.scm')
-rw-r--r-- | guix-qa-frontpage/manage-patch-branches.scm | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/guix-qa-frontpage/manage-patch-branches.scm b/guix-qa-frontpage/manage-patch-branches.scm index 56155f5..fd7188a 100644 --- a/guix-qa-frontpage/manage-patch-branches.scm +++ b/guix-qa-frontpage/manage-patch-branches.scm @@ -160,17 +160,6 @@ 'issue-patches-overall-status #:args (list issue-number))) - (define series-data - (call-with-values - (lambda () - (http-get (string->uri - (string-append - (%patchwork-instance) "/api/1.0" - "/series/" patchwork-series "/")) - #:streaming? #t)) - (lambda (response body) - (json->scm body)))) - (define (insert-log results) (define log (string-join @@ -182,14 +171,14 @@ (insert-create-branch-for-issue-log database issue-number log)) - (if (assoc-ref series-data "received_all") + (if (assoc-ref patchwork-series "received_all") (begin (simple-format #t "all patches have been received\n") (create-base-tag) (let loop ((patch-data (vector->list - (assoc-ref series-data "patches"))) + (assoc-ref patchwork-series "patches"))) (results '())) (if (null? patch-data) (begin @@ -291,7 +280,7 @@ (define* (start-manage-patch-branches-thread database metrics-registry - #:key (series-count 200)) + #:key series-count) (define (dig alist . parts) (if (pair? alist) (match parts @@ -401,6 +390,7 @@ database 'latest-patchwork-series-by-issue latest-patchwork-series-by-issue + #:args `(#:count ,series-count) #:ttl 120)) (issue-numbers (map string->number |