guix-commits
[Top][All Lists]
Advanced

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

branch master updated: Remove logging from enqueue-job-for-email


From: Christopher Baines
Subject: branch master updated: Remove logging from enqueue-job-for-email
Date: Wed, 11 Oct 2023 09:17:43 -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 d72b9a5  Remove logging from enqueue-job-for-email
d72b9a5 is described below

commit d72b9a523905e71be9d7c06de08fc49ac5a293fe
Author: Christopher Baines <mail@cbaines.net>
AuthorDate: Wed Oct 11 14:17:11 2023 +0100

    Remove logging from enqueue-job-for-email
    
    As getmail treats output to stderr as the operation failing.
---
 guix-data-service/branch-updated-emails.scm | 73 ++++++++++++++---------------
 1 file changed, 35 insertions(+), 38 deletions(-)

diff --git a/guix-data-service/branch-updated-emails.scm 
b/guix-data-service/branch-updated-emails.scm
index f369004..8b5290b 100644
--- a/guix-data-service/branch-updated-emails.scm
+++ b/guix-data-service/branch-updated-emails.scm
@@ -23,6 +23,7 @@
   #:use-module (squee)
   #:use-module (guix store)
   #:use-module (guix channels)
+  #:use-module (guix diagnostics)
   #:use-module (guix-data-service database)
   #:use-module (guix-data-service model git-repository)
   #:use-module (guix-data-service model git-branch)
@@ -89,47 +90,43 @@
                            (channel-instance
                             ;; Obtain a session level lock here, to avoid 
conflicts with
                             ;; other jobs over the Git repository.
-                            (with-advisory-session-lock/log-time
+                            (with-advisory-session-lock
                              conn
                              'latest-channel-instances
                              (lambda ()
-                               (with-store store
-                                 (first
-                                  (latest-channel-instances store
-                                                            (list 
channel-for-commit)
-                                                            #:authenticate?
-                                                            (fourth 
git-repository-details))))))))
+                               (parameterize ((current-output-port 
(%make-void-port "w"))
+                                              (current-error-port 
(%make-void-port "w"))
+                                              (guix-warning-port 
(%make-void-port "w")))
+                                 (with-store store
+                                   (first
+                                    (latest-channel-instances store
+                                                              (list 
channel-for-commit)
+                                                              #:authenticate?
+                                                              (fourth 
git-repository-details)))))))))
 
-                      (if (string=? (channel-instance-commit channel-instance)
-                                    x-git-newrev)
-                          (with-postgresql-transaction
-                           conn
-                           (lambda (conn)
-                             (exec-query conn "LOCK TABLE git_commits IN 
EXCLUSIVE MODE")
+                      (when (string=? (channel-instance-commit 
channel-instance)
+                                      x-git-newrev)
+                        (with-postgresql-transaction
+                         conn
+                         (lambda (conn)
+                           (exec-query conn "LOCK TABLE git_commits IN 
EXCLUSIVE MODE")
 
-                             (if (git-commit-exists? conn x-git-newrev)
-                                 (simple-format #t "commit already exists for 
revision ~A (date: ~A)\n"
-                                                x-git-newrev
-                                                date)
-                                 (begin
-                                   (insert-git-commit-entry conn
-                                                            (or 
(git-branch-for-repository-and-name
-                                                                 conn
-                                                                 
git-repository-id
-                                                                 branch-name)
-                                                                
(insert-git-branch-entry
-                                                                 conn
-                                                                 
git-repository-id
-                                                                 branch-name))
-                                                            x-git-newrev
-                                                            date)
+                           (unless (git-commit-exists? conn x-git-newrev)
+                             (insert-git-commit-entry conn
+                                                      (or 
(git-branch-for-repository-and-name
+                                                           conn
+                                                           git-repository-id
+                                                           branch-name)
+                                                          
(insert-git-branch-entry
+                                                           conn
+                                                           git-repository-id
+                                                           branch-name))
+                                                      x-git-newrev
+                                                      date)
 
-                                   (enqueue-load-new-guix-revision-job
-                                    conn
-                                    git-repository-id
-                                    x-git-newrev
-                                    (string-append x-git-repo " "
-                                                   x-git-refname " 
updated"))))))
-                          (simple-format #t "email newrev ~A doesn't match 
latest channel instance commit ~A\n"
-                                         x-git-newrev
-                                         (channel-instance-commit 
channel-instance)))))))))))))
+                             (enqueue-load-new-guix-revision-job
+                              conn
+                              git-repository-id
+                              x-git-newrev
+                              (string-append x-git-repo " "
+                                             x-git-refname " 
updated"))))))))))))))))



reply via email to

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