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)
|
||||
(spawn-fiber
|
||||
(lambda ()
|
||||
(with-resource-from-pool (connection-pool) conn
|
||||
(with-resource-from-pool (background-connection-pool) conn
|
||||
(with-exception-handler
|
||||
(lambda (exn)
|
||||
(simple-format
|
||||
|
|
|
|||
|
|
@ -75,9 +75,13 @@
|
|||
make-render-metrics
|
||||
controller
|
||||
|
||||
background-connection-pool
|
||||
connection-pool
|
||||
reserved-connection-pool))
|
||||
|
||||
(define background-connection-pool
|
||||
(make-parameter #f))
|
||||
|
||||
(define connection-pool
|
||||
(make-parameter #f))
|
||||
|
||||
|
|
|
|||
|
|
@ -198,7 +198,21 @@ port. Also, the port used can be changed by passing the --port option.\n"
|
|||
(primitive-exit 1))
|
||||
(lambda ()
|
||||
(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
|
||||
(lambda ()
|
||||
(open-postgresql-connection
|
||||
|
|
@ -246,7 +260,7 @@ port. Also, the port used can be changed by passing the --port option.\n"
|
|||
|
||||
(spawn-fiber
|
||||
(lambda ()
|
||||
(with-resource-from-pool (connection-pool) conn
|
||||
(with-resource-from-pool (background-connection-pool) conn
|
||||
(backfill-guix-revision-package-derivation-distribution-counts
|
||||
conn)))
|
||||
request-scheduler)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue