Stop using a pool of threads for database operations

Now that squee cooperates with suspendable ports, this is unnecessary. Use a
connection pool to still support running queries in parallel using multiple
connections.
This commit is contained in:
Christopher Baines 2023-07-09 16:52:35 +01:00
parent 672ee6216e
commit 7251c7d653
15 changed files with 1292 additions and 1310 deletions

View file

@ -22,6 +22,7 @@
#:use-module (guix-data-service utils)
#:use-module (guix-data-service database)
#:use-module (guix-data-service web render)
#:use-module (guix-data-service web controller)
#:use-module (guix-data-service web query-parameters)
#:use-module (guix-data-service web util)
#:use-module (guix-data-service model package)
@ -40,13 +41,12 @@
`((system ,parse-system #:default "x86_64-linux")
(target ,parse-target #:default "")))))
(letpar& ((package-versions-with-branches
(with-thread-postgresql-connection
(lambda (conn)
(branches-by-package-version conn name
(assq-ref parsed-query-parameters
'system)
(assq-ref parsed-query-parameters
'target))))))
(with-resource-from-pool (connection-pool) conn
(branches-by-package-version conn name
(assq-ref parsed-query-parameters
'system)
(assq-ref parsed-query-parameters
'target)))))
(case (most-appropriate-mime-type
'(application/json text/html)
mime-types)