guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

branch master updated: Use filter-map rather than filter and map when pr


From: Christopher Baines
Subject: branch master updated: Use filter-map rather than filter and map when processing linters
Date: Sun, 16 May 2021 15:57:01 -0400

This is an automated email from the git hooks/post-receive script.

cbaines pushed a commit to branch master
in repository data-service.

The following commit(s) were added to refs/heads/master by this push:
     new da0ee9d  Use filter-map rather than filter and map when processing 
linters
da0ee9d is described below

commit da0ee9dff0a730b06e9acb4611099f6174793e49
Author: Christopher Baines <mail@cbaines.net>
AuthorDate: Sun May 16 20:54:07 2021 +0100

    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.
---
 guix-data-service/jobs/load-new-guix-revision.scm | 30 +++++++++++------------
 1 file 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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]