From 9a6a991e302aea5297f73f57e074fa62eb05a58a Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Mon, 7 Jun 2021 10:09:24 +0100 Subject: Switch to a lower gc threshold in make-chunked-output-port* A fixed threshold should make things line up when there's multiple ports in use. --- guix-build-coordinator/utils.scm | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/guix-build-coordinator/utils.scm b/guix-build-coordinator/utils.scm index 1b7556e..c833183 100644 --- a/guix-build-coordinator/utils.scm +++ b/guix-build-coordinator/utils.scm @@ -262,8 +262,8 @@ upcoming chunk." (define* (make-chunked-output-port* port #:key (keep-alive? #f) (buffering 1200)) - (define initial-heap-size - (assq-ref (gc-stats) 'heap-size)) + (define heap-allocated-limit + (expt 2 20)) ;; 1MiB (define (%put-string s) (unless (string-null? s) @@ -279,13 +279,13 @@ upcoming chunk." (let* ((stats (gc-stats)) (initial-gc-times (assq-ref stats 'gc-times))) - (while (let ((updated-stats (gc-stats))) - (and (> (assq-ref updated-stats 'heap-allocated-since-gc) - initial-heap-size) - (= initial-gc-times - (assq-ref updated-stats 'gc-times)))) - (gc) - (usleep 10)))))) + (when (> (assq-ref stats 'heap-allocated-since-gc) + heap-allocated-limit) + (while (let ((updated-stats (gc-stats))) + (= (assq-ref updated-stats 'gc-times) + initial-gc-times)) + (gc) + (usleep 50))))))) (define (%put-char c) (%put-string (list->string (list c)))) -- cgit v1.2.3