guix-commits
[Top][All Lists]
Advanced

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

branch master updated: hydra/goggles: Only index new files.


From: Ricardo Wurmus
Subject: branch master updated: hydra/goggles: Only index new files.
Date: Fri, 24 Apr 2020 08:46:36 -0400

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

rekado pushed a commit to branch master
in repository maintenance.

The following commit(s) were added to refs/heads/master by this push:
     new 1122e24  hydra/goggles: Only index new files.
1122e24 is described below

commit 1122e244a502fff54da5046a42951fc493c22b5e
Author: Ricardo Wurmus <address@hidden>
AuthorDate: Fri Apr 24 14:45:50 2020 +0200

    hydra/goggles: Only index new files.
    
    * hydra/goggles.scm (index-channel-logs): Only index files newer than
    the last modification time of the Xapian database.
---
 hydra/goggles.scm | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/hydra/goggles.scm b/hydra/goggles.scm
index b235138..3053ebb 100755
--- a/hydra/goggles.scm
+++ b/hydra/goggles.scm
@@ -47,6 +47,15 @@
 
 (define (index-channel-logs channel)
   "Index all messages in the logs for CHANNEL."
+  (define new?
+    (let* ((file (string-append %log-xapian-db "/postlist.glass"))
+           (reference
+            (and (file-exists? file)
+                 (and=> (stat file) stat:mtime))))
+      (lambda (file)
+        (if reference
+            (> (and=> (stat file) stat:mtime) reference)
+            #t))))
   (format (current-error-port) "Indexing ~a~%" channel)
   (call-with-writable-database %log-xapian-db
     (lambda (db)
@@ -84,8 +93,9 @@
                (unless (eof-object? line)
                  (index-message line count)
                  (loop (read-line) (1+ count)))))))
-       (map (cut string-append %log-root "/#" channel "/" <>)
-            (channel-files channel)))))
+       (filter new?
+               (map (cut string-append %log-root "/#" channel "/" <>)
+                    (channel-files channel))))))
   (format (current-error-port) "Indexing ~a complete!~%" channel))
 
 (define* (parse-query* querystring #:key stemmer stemming-strategy



reply via email to

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