diff options
author | Christopher Baines <mail@cbaines.net> | 2023-04-22 17:14:07 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2023-04-22 17:14:07 +0100 |
commit | b43f0a967d68fb1c5ce1f2c82727c78e8b954b6c (patch) | |
tree | 5d3b2949f9446ed7a3e2043e255959d4267c29c5 /guix-build-coordinator | |
parent | 42a5de6efee46cf1482185f869aaea5544f3fc66 (diff) | |
download | build-coordinator-b43f0a967d68fb1c5ce1f2c82727c78e8b954b6c.tar build-coordinator-b43f0a967d68fb1c5ce1f2c82727c78e8b954b6c.tar.gz |
Don't block writes for as long when attempting checkpoints
Diffstat (limited to 'guix-build-coordinator')
-rw-r--r-- | guix-build-coordinator/datastore/sqlite.scm | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/guix-build-coordinator/datastore/sqlite.scm b/guix-build-coordinator/datastore/sqlite.scm index 31f2f4d..a93b377 100644 --- a/guix-build-coordinator/datastore/sqlite.scm +++ b/guix-build-coordinator/datastore/sqlite.scm @@ -259,9 +259,10 @@ metrics-registry checkpoint-duration-metric-name (lambda () - (when (> (wal-size) extreme-wal-size-threshold) - ;; Since the WAL is really getting too big, wait for much longer - (sqlite-exec db "PRAGMA busy_timeout = 300000;")) + (if (> (wal-size) extreme-wal-size-threshold) + ;; Since the WAL is really getting too big, wait for much longer + (sqlite-exec db "PRAGMA busy_timeout = 300000;") + (sqlite-exec db "PRAGMA busy_timeout = 100;")) (let* ((statement (sqlite-prepare @@ -326,9 +327,11 @@ PRAGMA optimize;") (retry-count 0)) (if result #t - (if (< retry-count 10) - (loop (datastore-optimize datastore) - (+ 1 retry-count)) + (if (< retry-count 300) + (begin + (sleep 0.1) + (loop (datastore-optimize datastore) + (+ 1 retry-count))) (error "unable to perform WAL checkpoint")))))) #:unwind? #t))) #:parallel? #t)) |