diff options
author | Christopher Baines <mail@cbaines.net> | 2022-12-06 09:14:37 +0000 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2022-12-06 09:14:37 +0000 |
commit | 76f2082a57370acb315fd5620081bae8957eeac8 (patch) | |
tree | f98b9637861189af3337f870d6d68425c6e84ba7 | |
parent | 9ab04cb7ae5daaf2527bcc1f683dccca41615399 (diff) | |
download | qa-frontpage-76f2082a57370acb315fd5620081bae8957eeac8.tar qa-frontpage-76f2082a57370acb315fd5620081bae8957eeac8.tar.gz |
Improve caching of the base and target refs
-rw-r--r-- | guix-qa-frontpage/server.scm | 95 |
1 files changed, 46 insertions, 49 deletions
diff --git a/guix-qa-frontpage/server.scm b/guix-qa-frontpage/server.scm index fe3d344..b3c0953 100644 --- a/guix-qa-frontpage/server.scm +++ b/guix-qa-frontpage/server.scm @@ -314,65 +314,62 @@ #:ttl 1200) (string->number number)))) (if series - (let* ((derivation-changes + (let* ((base-and-target-refs + (with-sqlite-cache + database + 'issue-branch-base-and-target-refs + get-issue-branch-base-and-target-refs + #:args (list (string->number number)) + #:ttl 1200)) + (derivation-changes change-details (call-with-values (lambda () - (and=> - (with-sqlite-cache - database - 'issue-branch-base-and-target-refs - get-issue-branch-base-and-target-refs - #:args (list (string->number number)) - #:ttl 1200) - (lambda (base-and-target-refs) - (with-exception-handler - (lambda (exn) - (simple-format - (current-error-port) - "exception fetching derivation changes: ~A\n" - exn) + (and + base-and-target-refs + (with-exception-handler + (lambda (exn) + (simple-format + (current-error-port) + "exception fetching derivation changes: ~A\n" + exn) - (values #f #f)) - (lambda () - (with-sqlite-cache - database - 'derivation-changes - patch-series-derivation-changes - #:args - (list - (patch-series-derivation-changes-url - base-and-target-refs - #:systems %systems-to-submit-builds-for)) - #:ttl 6000)) - #:unwind? #t)))) + (values #f #f)) + (lambda () + (with-sqlite-cache + database + 'derivation-changes + patch-series-derivation-changes + #:args + (list + (patch-series-derivation-changes-url + base-and-target-refs + #:systems %systems-to-submit-builds-for)) + #:ttl 6000)) + #:unwind? #t))) (lambda res (match res ((#f) (values #f #f)) (_ (apply values res)))))) - (base-and-target-refs - (get-issue-branch-base-and-target-refs - (string->number number))) (comparison-details - (and=> + (and base-and-target-refs - (lambda (base-and-target-refs) - (with-exception-handler - (lambda (exn) - (if (guix-data-service-error? exn) - exn - (raise-exception exn))) - (lambda () - (with-sqlite-cache - database - 'lint-warnings - patch-series-comparison - #:args - (list (patch-series-compare-url - base-and-target-refs)) - #:ttl 6000)) - #:unwind? #t))))) + (with-exception-handler + (lambda (exn) + (if (guix-data-service-error? exn) + exn + (raise-exception exn))) + (lambda () + (with-sqlite-cache + database + 'lint-warnings + patch-series-comparison + #:args + (list (patch-series-compare-url + base-and-target-refs)) + #:ttl 6000)) + #:unwind? #t)))) (render-html #:sxml (issue-view number series @@ -495,7 +492,7 @@ port. Also, the port used can be changed by passing the --port option.\n" 'issue-branch-base-and-target-refs get-issue-branch-base-and-target-refs #:args (list (car series)) - #:ttl 1200) + #:ttl 0) (lambda (base-and-target-refs) (with-sqlite-cache database |