summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2020-01-24 19:04:21 +0000
committerChristopher Baines <mail@cbaines.net>2020-01-25 22:32:09 +0000
commite34d773faf7309d4273fe204149845999d4ed8a7 (patch)
tree36c04c21af678ceaedb1527fbb1623852a9be76f /tests
parent0d23a6d374340f3f9a3b035f960abd39447e11c3 (diff)
downloadcuirass-e34d773faf7309d4273fe204149845999d4ed8a7.tar
cuirass-e34d773faf7309d4273fe204149845999d4ed8a7.tar.gz
Adjust make-worker-thread-channel to take an initializer.
While this is a generic method, and initializer function will give the flexibility required to create multiple worker threads for performing SQLite queries, each with it's own database connection (as a result of calling the initializer once for each thread). Without this change, they'd all have to use the same connection, which would not work. * src/cuirass/utils.scm (make-worker-thread-channel): Change procedure to take an initializer, rather than arguments directly. * src/cuirass/database.scm (with-database): Adjust to call make-worker-thread-channel with an initializer. * tests/database.scm (db-init): Change to use make-worker-thread-channel initializer. * tests/http.scm (db-init): Change to use make-worker-thread-channel initializer.
Diffstat (limited to 'tests')
-rw-r--r--tests/database.scm4
-rw-r--r--tests/http.scm4
2 files changed, 6 insertions, 2 deletions
diff --git a/tests/database.scm b/tests/database.scm
index 271f166..6098465 100644
--- a/tests/database.scm
+++ b/tests/database.scm
@@ -87,7 +87,9 @@
(test-assert "db-init"
(begin
(%db (db-init database-name))
- (%db-channel (make-worker-thread-channel (%db)))
+ (%db-channel (make-worker-thread-channel
+ (lambda ()
+ (list (%db)))))
#t))
(test-assert "sqlite-exec"
diff --git a/tests/http.scm b/tests/http.scm
index 337a775..d20a3c3 100644
--- a/tests/http.scm
+++ b/tests/http.scm
@@ -108,7 +108,9 @@
(test-assert "db-init"
(begin
(%db (db-init database-name))
- (%db-channel (make-worker-thread-channel (%db)))
+ (%db-channel (make-worker-thread-channel
+ (lambda ()
+ (list (%db)))))
#t))
(test-assert "cuirass-run"