From da0ee9dff0a730b06e9acb4611099f6174793e49 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Sun, 16 May 2021 20:54:07 +0100 Subject: [PATCH] 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. --- .../jobs/load-new-guix-revision.scm | 28 +++++++++---------- 1 file changed, 13 insertions(+), 15 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)) + (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)))))) - (list ,@(map inferior-package-id packages))))))) + (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)