aboutsummaryrefslogtreecommitdiff
path: root/guix-qa-frontpage/manage-patch-branches.scm
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2023-05-23 13:54:38 +0100
committerChristopher Baines <mail@cbaines.net>2023-05-23 13:54:38 +0100
commit83b209914739322ba0abd1c726a1a835a5ad775e (patch)
treea91fbc17bafbe603902e51f7501a79b8d04a2e21 /guix-qa-frontpage/manage-patch-branches.scm
parent70562254be9894d2422279ee69dd8f3bcc80bf50 (diff)
downloadqa-frontpage-83b209914739322ba0abd1c726a1a835a5ad775e.tar
qa-frontpage-83b209914739322ba0abd1c726a1a835a5ad775e.tar.gz
Memoize checking for changes against the latest master revision
To speed this up.
Diffstat (limited to 'guix-qa-frontpage/manage-patch-branches.scm')
-rw-r--r--guix-qa-frontpage/manage-patch-branches.scm22
1 files changed, 15 insertions, 7 deletions
diff --git a/guix-qa-frontpage/manage-patch-branches.scm b/guix-qa-frontpage/manage-patch-branches.scm
index db4fdc9..9dcbd72 100644
--- a/guix-qa-frontpage/manage-patch-branches.scm
+++ b/guix-qa-frontpage/manage-patch-branches.scm
@@ -11,6 +11,7 @@
#:use-module (web client)
#:use-module (json)
#:use-module (guix sets)
+ #:use-module (guix memoization)
#:use-module (guix build utils)
#:use-module (guix-build-coordinator utils)
#:use-module ((guix build download) #:select (http-fetch))
@@ -226,6 +227,19 @@
(latest-master-revision
(get-latest-processed-branch-revision "master")))
+ ;; Several series can use the same base revision, so memoize looking up
+ ;; the changes compared to master
+ (define get-changes-compared-to-master
+ (memoize
+ (lambda (base-commit)
+ (length
+ (revision-derivation-changes
+ (revision-derivation-changes-url
+ `((base . ,base-commit)
+ (target . ,latest-master-revision))
+ ;; TODO: Maybe do something smarter here?
+ #:systems '("x86_64-linux")))))))
+
(simple-format #t "checking for branches to delete (looking at ~A branches)\n"
(length issue-numbers))
(for-each
@@ -265,13 +279,7 @@
#f)))
(lambda ()
(let ((derivation-change-count
- (length
- (revision-derivation-changes
- (revision-derivation-changes-url
- `((base . ,base-commit)
- (target . ,latest-master-revision))
- ;; TODO: Maybe do something smarter here?
- #:systems '("x86_64-linux"))))))
+ (get-changes-compared-to-master base-commit)))
(if (> derivation-change-count 10000)
(begin
(simple-format