diff options
author | Christopher Baines <mail@cbaines.net> | 2021-06-07 10:09:24 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2021-06-07 10:09:24 +0100 |
commit | 9a6a991e302aea5297f73f57e074fa62eb05a58a (patch) | |
tree | a3c06656ae1cc3c23ccf1b002f5da59635671022 | |
parent | f9af463e81d9fcc712d7c58a491101d8d17457e8 (diff) | |
download | build-coordinator-9a6a991e302aea5297f73f57e074fa62eb05a58a.tar build-coordinator-9a6a991e302aea5297f73f57e074fa62eb05a58a.tar.gz |
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.
-rw-r--r-- | guix-build-coordinator/utils.scm | 18 |
1 files 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)))) |