From 1b5630ec7f37f0b828317b0eac1b69a796726068 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Sat, 18 May 2024 10:24:57 +0100 Subject: Cache series entries for each individual issue So that you don't have to load the whole list from the cache each time. --- guix-qa-frontpage/issue.scm | 11 +++++++++++ guix-qa-frontpage/patchwork.scm | 6 +++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/guix-qa-frontpage/issue.scm b/guix-qa-frontpage/issue.scm index 94267a5..eacd6e0 100644 --- a/guix-qa-frontpage/issue.scm +++ b/guix-qa-frontpage/issue.scm @@ -328,6 +328,17 @@ (take latest-series number-of-series-to-refresh) latest-series))) + (for-each + (match-lambda + ((issue-number . data) + (with-sqlite-cache + database + 'latest-patchwork-series-for-issue + (const data) + #:args (list issue-number) + #:ttl 0))) + latest-series) + (non-blocking (lambda () (update-repository!))) diff --git a/guix-qa-frontpage/patchwork.scm b/guix-qa-frontpage/patchwork.scm index 049012f..cb91e30 100644 --- a/guix-qa-frontpage/patchwork.scm +++ b/guix-qa-frontpage/patchwork.scm @@ -320,6 +320,6 @@ series-by-issue-number mumi-data))))))) - - - +(define (latest-patchwork-series-for-issue issue-number #:key patchwork) + (assq-ref (latest-patchwork-series-by-issue #:patchwork patchwork) + issue-number)) -- cgit v1.2.3