+(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
+activity for a while. The duration is given by SECONDS-AGO, which
+defaults to 30 days."
+ (define threshold
+ (number->string
+ (time-second
+ (subtract-duration (current-time)
+ (make-time time-duration 0 seconds-ago)))))
+ (define cache-key
+ (list 'forgotten-bug-numbers packages seconds-ago))
+ (define cached (cached? cache-key))
+ (or cached
+ (let ((result
+ (filter-index (lambda (line)
+ (any (lambda (package)
+ (and (string-prefix? package line)
+ (let ((fields (string-split line #\space)))
+ (and (string=? "open" (fourth fields))
+ (string< (third fields) threshold)))))
+ packages))
+ (lambda (line)
+ (second (string-split line #\space))))))
+ (cache! cache-key result)
+ result)))
+