From 3df0b43146e20b8d86da5f890ca5cc163e929805 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Mon, 17 Jun 2019 16:58:31 +0100 Subject: Use line buffering for the input and output ports As these are used for logging, which is done on a line by line basis. Remove the now redundant calls to (force-output). --- guix-data-service/jobs/load-new-guix-revision.scm | 5 ----- guix-data-service/model/derivation.scm | 2 -- scripts/guix-data-service-process-jobs.in | 3 +++ scripts/guix-data-service.in | 3 +++ 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/guix-data-service/jobs/load-new-guix-revision.scm b/guix-data-service/jobs/load-new-guix-revision.scm index af8f4fa..a79d02a 100644 --- a/guix-data-service/jobs/load-new-guix-revision.scm +++ b/guix-data-service/jobs/load-new-guix-revision.scm @@ -33,13 +33,11 @@ (define (log-time action f) (simple-format #t "debug: Starting ~A\n" action) - (force-output) (let* ((start-time (current-time)) (result (f)) (time-taken (- (current-time) start-time))) (simple-format #t "debug: Finished ~A, took ~A seconds\n" action time-taken) - (force-output) result)) (define (all-inferior-package-derivations store inf packages) @@ -124,7 +122,6 @@ (package-name package) key args) - (force-output) (exit 1)) (begin (simple-format @@ -133,7 +130,6 @@ (package-name package) key args) - (force-output) '())))))) (list ,@(map inferior-package-id packages))))) @@ -425,7 +421,6 @@ "Failed extracting information from commit: ~A\n\n" commit) (simple-format (current-error-port) " ~A ~A\n\n" key args) - (force-output) #f))))) (define (store-item-for-git-repository-id-and-commit diff --git a/guix-data-service/model/derivation.scm b/guix-data-service/model/derivation.scm index e5de539..df44814 100644 --- a/guix-data-service/model/derivation.scm +++ b/guix-data-service/model/derivation.scm @@ -362,7 +362,6 @@ ORDER BY derivations.system DESC, (simple-format #t "debug: ensure-input-derivations-exist: processing ~A derivations\n" (length input-derivation-file-names)) - (force-output) (let* ((existing-derivation-entries (derivation-file-names->vhash conn derivation-ids-hash-table @@ -443,7 +442,6 @@ ORDER BY derivations.system DESC, (simple-format #t "debug: insert-missing-derivations: ensure-input-derivations-exist\n") - (force-output) (ensure-input-derivations-exist (deduplicate-strings (map derivation-input-path diff --git a/scripts/guix-data-service-process-jobs.in b/scripts/guix-data-service-process-jobs.in index f0338a7..e4347e4 100644 --- a/scripts/guix-data-service-process-jobs.in +++ b/scripts/guix-data-service-process-jobs.in @@ -27,6 +27,9 @@ (guix-data-service database) (guix-data-service jobs)) +(setvbuf (current-output-port) 'line) +(setvbuf (current-error-port) 'line) + (with-postgresql-connection (lambda (conn) (simple-format #t "Ready to process jobs...\n") diff --git a/scripts/guix-data-service.in b/scripts/guix-data-service.in index 1c57c57..a0d64cf 100644 --- a/scripts/guix-data-service.in +++ b/scripts/guix-data-service.in @@ -80,6 +80,9 @@ (error "extraneous argument" arg)) %default-options)) +(setvbuf (current-output-port) 'line) +(setvbuf (current-error-port) 'line) + (let ((opts (parse-options (cdr (program-arguments))))) (let ((repl-port (assoc-ref opts 'listen-repl))) (when repl-port -- cgit v1.2.3