diff options
author | Ricardo Wurmus <rekado@elephly.net> | 2020-05-10 11:24:40 +0200 |
---|---|---|
committer | Ricardo Wurmus <rekado@elephly.net> | 2020-05-10 11:24:40 +0200 |
commit | 8a0748bb55a5f3b702d025fd0f1b015ff967441e (patch) | |
tree | 8fafe5ef7f4e18956b31e5b42e4f39bcf40ba959 | |
parent | f47e75e5665431f146c0440f4d2fb5115c5554c9 (diff) |
debbugs: Cache result of extract-bug-numbers.
-rw-r--r-- | mumi/debbugs.scm | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/mumi/debbugs.scm b/mumi/debbugs.scm index 086e89a..4e0666f 100644 --- a/mumi/debbugs.scm +++ b/mumi/debbugs.scm @@ -141,13 +141,20 @@ search the index of archived issues." "Open up a Debbugs index file and return the bug numbers for those lines that match one of PACKAGES. If ARCHIVED? is #T search the index of archived issues." - (filter-index (lambda (line) - (any (lambda (package) - (string-prefix? package line)) - packages)) - (lambda (line) - (second (string-split line #\space))) - #:archived? archived?)) + (define cache-key + (list 'extract-bug-numbers packages archived?)) + (define cached (cached? cache-key)) + (or cached + (let ((result + (filter-index (lambda (line) + (any (lambda (package) + (string-prefix? package line)) + packages)) + (lambda (line) + (second (string-split line #\space))) + #:archived? archived?))) + (cache! cache-key result) + result))) (define* (forgotten-bug-numbers packages #:key (seconds-ago (* 60 60 24 30))) "Return the numbers of issues that are open but haven't seen any |