aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2019-06-17 16:58:31 +0100
committerChristopher Baines <mail@cbaines.net>2019-06-17 18:09:10 +0100
commit3df0b43146e20b8d86da5f890ca5cc163e929805 (patch)
tree324a682f73777f9002c2e2d7d0cec9a2d709ac93
parent7f0a0ed3b13c4a650ffb7c4cb6693b1b23d0f628 (diff)
downloaddata-service-3df0b43146e20b8d86da5f890ca5cc163e929805.tar
data-service-3df0b43146e20b8d86da5f890ca5cc163e929805.tar.gz
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).
-rw-r--r--guix-data-service/jobs/load-new-guix-revision.scm5
-rw-r--r--guix-data-service/model/derivation.scm2
-rw-r--r--scripts/guix-data-service-process-jobs.in3
-rw-r--r--scripts/guix-data-service.in3
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