diff options
Diffstat (limited to 'guix-qa-frontpage/server.scm')
-rw-r--r-- | guix-qa-frontpage/server.scm | 77 |
1 files changed, 44 insertions, 33 deletions
diff --git a/guix-qa-frontpage/server.scm b/guix-qa-frontpage/server.scm index 2e25f69..25f550a 100644 --- a/guix-qa-frontpage/server.scm +++ b/guix-qa-frontpage/server.scm @@ -35,6 +35,7 @@ #:select (with-time-logging get-gc-metrics-updater call-with-delay-logging)) #:use-module (guix-qa-frontpage database) + #:use-module (guix-qa-frontpage derivation-changes) #:use-module (guix-qa-frontpage patchwork) #:use-module (guix-qa-frontpage mumi) #:use-module (guix-qa-frontpage issue) @@ -106,21 +107,20 @@ #:sxml (branches-view branches)))) (('GET "branch" branch) - (let ((derivation-changes - change-details + (let ((change-details + derivation-changes-counts (with-sqlite-cache database - 'branch-derivation-changes - branch-derivation-changes + 'branch-data + branch-data #:args - (list (branch-derivation-changes-url - branch - #:systems %systems-to-submit-builds-for)) + (list branch) #:ttl 6000))) (render-html #:sxml (branch-view branch - derivation-changes)))) + change-details + derivation-changes-counts)))) (('GET "patches") (let* ((latest-series (with-sqlite-cache @@ -445,6 +445,23 @@ Check if it's already running, or whether another process is using that port. Also, the port used can be changed by passing the --port option.\n" port))))))) +(define* (branch-data branch-name) + (let* ((derivation-changes + change-details + (branch-derivation-changes + (branch-derivation-changes-url + branch-name + #:systems %systems-to-submit-builds-for))) + + (derivation-changes-counts + (derivation-changes-counts + derivation-changes + %systems-to-submit-builds-for))) + + (values + change-details + derivation-changes-counts))) + (define* (start-refresh-patch-branches-data-thread database #:key @@ -588,31 +605,25 @@ port. Also, the port used can be changed by passing the --port option.\n" "refreshing data for ~A branch\n" branch-name) - (let ((derivation-changes - (with-exception-handler - (lambda (exn) - (simple-format - (current-error-port) - "failed fetching derivation changes for branch ~A: ~A\n" - branch-name - exn) - - #f) - (lambda () - (let ((derivation-changes-url - (branch-derivation-changes-url - branch-name - #:systems %systems-to-submit-builds-for))) - - (with-sqlite-cache - database - 'branch-derivation-changes - branch-derivation-changes - #:args - (list derivation-changes-url) - #:ttl (/ frequency 2)))) - #:unwind? #t))) - #f))) + (with-exception-handler + (lambda (exn) + (simple-format + (current-error-port) + "failed fetching derivation changes for branch ~A: ~A\n" + branch-name + exn) + + #f) + (lambda () + (with-sqlite-cache + database + 'branch-data + branch-data + #:args + (list branch-name) + #:ttl (/ frequency 2)))) + #:unwind? #t) + #t) branches))) (call-with-new-thread |