aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2021-05-16 20:54:07 +0100
committerChristopher Baines <mail@cbaines.net>2021-05-16 20:54:07 +0100
commitda0ee9dff0a730b06e9acb4611099f6174793e49 (patch)
tree3c6ab93a7137532371c0b8e4411241d57dc76a64
parent2a4b16f5e4c46edf9e507e54b4b5d1430deed72d (diff)
downloaddata-service-da0ee9dff0a730b06e9acb4611099f6174793e49.tar
data-service-da0ee9dff0a730b06e9acb4611099f6174793e49.tar.gz
Use filter-map rather than filter and map when processing linters
I guess this is a good change in general, but this seems to avoid a long stack, which when a linter crashes, and the inferior tries to return the exception details, and apparently hang the inferior/client as the reply isn't written/read.
-rw-r--r--guix-data-service/jobs/load-new-guix-revision.scm30
1 files changed, 14 insertions, 16 deletions
diff --git a/guix-data-service/jobs/load-new-guix-revision.scm b/guix-data-service/jobs/load-new-guix-revision.scm
index 04e030c..7db25a9 100644
--- a/guix-data-service/jobs/load-new-guix-revision.scm
+++ b/guix-data-service/jobs/load-new-guix-revision.scm
@@ -474,22 +474,20 @@ WHERE job_id = $1")
(cons (cons source-locale source-message)
messages-by-locale))))
- (filter
- (match-lambda
- ((package-id . warnings)
- (not (null? warnings))))
- (map
- (lambda (package-id)
- (let ((package (hashv-ref %package-table package-id)))
- (cons
- package-id
- (map process-lint-warning
- (if (and lint-checker-requires-store?-defined?
- (lint-checker-requires-store? checker))
-
- (check package #:store store)
- (check package))))))
- (list ,@(map inferior-package-id packages)))))))
+ (filter-map
+ (lambda (package-id)
+ (let* ((package (hashv-ref %package-table package-id))
+ (warnings
+ (map process-lint-warning
+ (if (and lint-checker-requires-store?-defined?
+ (lint-checker-requires-store? checker))
+
+ (check package #:store store)
+ (check package)))))
+ (if (null? warnings)
+ #f
+ (cons package-id warnings))))
+ (list ,@(map inferior-package-id packages))))))
(and
(or (inferior-eval '(and (resolve-module '(guix lint) #:ensure #f)