guix-commits
[Top][All Lists]
Advanced

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

01/03: Return a number from count-guix-revisions


From: Christopher Baines
Subject: 01/03: Return a number from count-guix-revisions
Date: Sun, 20 Sep 2020 14:14:10 -0400 (EDT)

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

commit 857ac36711d84ab3dab5b73fc5f25f158a1af3b9
Author: Christopher Baines <mail@cbaines.net>
AuthorDate: Sun Sep 20 18:38:39 2020 +0100

    Return a number from count-guix-revisions
---
 guix-data-service/model/guix-revision.scm | 8 ++++----
 guix-data-service/web/controller.scm      | 5 +----
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/guix-data-service/model/guix-revision.scm 
b/guix-data-service/model/guix-revision.scm
index 4dd4100..1cde5e2 100644
--- a/guix-data-service/model/guix-revision.scm
+++ b/guix-data-service/model/guix-revision.scm
@@ -30,10 +30,10 @@
             guix-revisions-cgit-url-bases))
 
 (define (count-guix-revisions conn)
-  (first
-   (exec-query
-    conn
-    "SELECT COUNT(*) FROM guix_revisions")))
+  (match (exec-query
+          conn
+          "SELECT COUNT(*) FROM guix_revisions")
+    (((x)) (string->number x))))
 
 (define (most-recent-n-guix-revisions conn n)
   (exec-query conn "SELECT * FROM guix_revisions ORDER BY id DESC LIMIT 10"))
diff --git a/guix-data-service/web/controller.scm 
b/guix-data-service/web/controller.scm
index a9a8a3e..863805f 100644
--- a/guix-data-service/web/controller.scm
+++ b/guix-data-service/web/controller.scm
@@ -348,10 +348,7 @@
                   (with-postgresql-connection
                    "web healthcheck"
                    (lambda (conn)
-                     (number?
-                      (string->number
-                       (first
-                        (count-guix-revisions conn)))))))
+                     (number? (count-guix-revisions conn)))))
                 (lambda (key . args)
                   #f))))
          (render-json



reply via email to

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