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).
This commit is contained in:
Christopher Baines 2019-06-17 16:58:31 +01:00
parent 7f0a0ed3b1
commit 3df0b43146
4 changed files with 6 additions and 7 deletions

View File

@ -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

View File

@ -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

View File

@ -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")

View File

@ -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