Add a new background connection pool
Mostly to constrain the build server event handlers.
This commit is contained in:
parent
b7ce9fe008
commit
aca5f8ca05
3 changed files with 21 additions and 3 deletions
|
|
@ -124,7 +124,7 @@
|
||||||
(define (spawn-fiber-for-handler handler)
|
(define (spawn-fiber-for-handler handler)
|
||||||
(spawn-fiber
|
(spawn-fiber
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(with-resource-from-pool (connection-pool) conn
|
(with-resource-from-pool (background-connection-pool) conn
|
||||||
(with-exception-handler
|
(with-exception-handler
|
||||||
(lambda (exn)
|
(lambda (exn)
|
||||||
(simple-format
|
(simple-format
|
||||||
|
|
|
||||||
|
|
@ -75,9 +75,13 @@
|
||||||
make-render-metrics
|
make-render-metrics
|
||||||
controller
|
controller
|
||||||
|
|
||||||
|
background-connection-pool
|
||||||
connection-pool
|
connection-pool
|
||||||
reserved-connection-pool))
|
reserved-connection-pool))
|
||||||
|
|
||||||
|
(define background-connection-pool
|
||||||
|
(make-parameter #f))
|
||||||
|
|
||||||
(define connection-pool
|
(define connection-pool
|
||||||
(make-parameter #f))
|
(make-parameter #f))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -198,7 +198,21 @@ port. Also, the port used can be changed by passing the --port option.\n"
|
||||||
(primitive-exit 1))
|
(primitive-exit 1))
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(parameterize
|
(parameterize
|
||||||
((connection-pool
|
((background-connection-pool
|
||||||
|
(make-resource-pool
|
||||||
|
(lambda ()
|
||||||
|
(open-postgresql-connection
|
||||||
|
"background"
|
||||||
|
postgresql-statement-timeout))
|
||||||
|
4
|
||||||
|
#:name "background"
|
||||||
|
#:idle-seconds 5
|
||||||
|
#:destructor
|
||||||
|
(lambda (conn)
|
||||||
|
(close-postgresql-connection conn "background"))
|
||||||
|
#:scheduler priority-scheduler))
|
||||||
|
|
||||||
|
(connection-pool
|
||||||
(make-resource-pool
|
(make-resource-pool
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(open-postgresql-connection
|
(open-postgresql-connection
|
||||||
|
|
@ -246,7 +260,7 @@ port. Also, the port used can be changed by passing the --port option.\n"
|
||||||
|
|
||||||
(spawn-fiber
|
(spawn-fiber
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(with-resource-from-pool (connection-pool) conn
|
(with-resource-from-pool (background-connection-pool) conn
|
||||||
(backfill-guix-revision-package-derivation-distribution-counts
|
(backfill-guix-revision-package-derivation-distribution-counts
|
||||||
conn)))
|
conn)))
|
||||||
request-scheduler)
|
request-scheduler)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue