Update use of resource pools
This commit is contained in:
parent
9bf4eea2fd
commit
258ee0468b
4 changed files with 22 additions and 31 deletions
|
|
@ -1905,8 +1905,7 @@ SELECT 1 FROM derivation_source_file_nars WHERE derivation_source_file_id = $1"
|
||||||
'load-new-guix-revision-inserts))
|
'load-new-guix-revision-inserts))
|
||||||
db-conn)
|
db-conn)
|
||||||
1
|
1
|
||||||
#:name "postgres"
|
#:name "postgres"))
|
||||||
#:min-size 0))
|
|
||||||
|
|
||||||
(define package-ids-promise
|
(define package-ids-promise
|
||||||
(fibers-delay
|
(fibers-delay
|
||||||
|
|
@ -2265,8 +2264,7 @@ SELECT 1 FROM derivation_source_file_nars WHERE derivation_source_file_id = $1"
|
||||||
(make-resource-pool
|
(make-resource-pool
|
||||||
(const channel-instances-conn)
|
(const channel-instances-conn)
|
||||||
1
|
1
|
||||||
#:name "postgres"
|
#:name "postgres")))
|
||||||
#:min-size 0)))
|
|
||||||
|
|
||||||
(unless existing-guix-revision-id
|
(unless existing-guix-revision-id
|
||||||
(let* ((derivations-by-system
|
(let* ((derivations-by-system
|
||||||
|
|
@ -2843,8 +2841,6 @@ SKIP LOCKED")
|
||||||
|
|
||||||
(%thread-pool-default-timeout #f)
|
(%thread-pool-default-timeout #f)
|
||||||
|
|
||||||
(resource-pool-retry-checkout-timeout 120)
|
|
||||||
|
|
||||||
(add-hook! after-gc-hook
|
(add-hook! after-gc-hook
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(simple-format (current-error-port)
|
(simple-format (current-error-port)
|
||||||
|
|
|
||||||
|
|
@ -125,25 +125,23 @@
|
||||||
(define (spawn-fiber-for-handler handler)
|
(define (spawn-fiber-for-handler handler)
|
||||||
(spawn-fiber
|
(spawn-fiber
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(parameterize
|
(call-with-resource-from-pool (background-connection-pool)
|
||||||
((resource-pool-retry-checkout-timeout (* 60 60 6)))
|
(lambda (conn)
|
||||||
(call-with-resource-from-pool (background-connection-pool)
|
(with-exception-handler
|
||||||
(lambda (conn)
|
(lambda (exn)
|
||||||
(with-exception-handler
|
(simple-format
|
||||||
(lambda (exn)
|
(current-error-port)
|
||||||
(simple-format
|
"exception in build event handler: ~A\n"
|
||||||
(current-error-port)
|
exn))
|
||||||
"exception in build event handler: ~A\n"
|
(lambda ()
|
||||||
exn))
|
(with-throw-handler #t
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(with-throw-handler #t
|
(handler conn))
|
||||||
(lambda ()
|
(lambda _
|
||||||
(handler conn))
|
(display (backtrace) (current-error-port))
|
||||||
(lambda _
|
(display "\n" (current-error-port)))))
|
||||||
(display (backtrace) (current-error-port))
|
#:unwind? #t))
|
||||||
(display "\n" (current-error-port)))))
|
#:timeout #f))))
|
||||||
#:unwind? #t))
|
|
||||||
#:timeout #f)))))
|
|
||||||
|
|
||||||
(define (with-build-ids-for-status data
|
(define (with-build-ids-for-status data
|
||||||
build-ids
|
build-ids
|
||||||
|
|
|
||||||
|
|
@ -814,9 +814,7 @@
|
||||||
(('GET "builds")
|
(('GET "builds")
|
||||||
(delegate-to build-controller))
|
(delegate-to build-controller))
|
||||||
(('GET "metrics")
|
(('GET "metrics")
|
||||||
(parameterize
|
(render-metrics))
|
||||||
((resource-pool-default-timeout 6))
|
|
||||||
(render-metrics)))
|
|
||||||
(('GET "revision" args ...)
|
(('GET "revision" args ...)
|
||||||
(delegate-to revision-controller))
|
(delegate-to revision-controller))
|
||||||
(('GET "repositories")
|
(('GET "repositories")
|
||||||
|
|
|
||||||
|
|
@ -210,9 +210,8 @@ port. Also, the port used can be changed by passing the --port option.\n"
|
||||||
#:destructor
|
#:destructor
|
||||||
(lambda (conn)
|
(lambda (conn)
|
||||||
(close-postgresql-connection conn "web-reserved"))
|
(close-postgresql-connection conn "web-reserved"))
|
||||||
#:scheduler priority-scheduler))
|
#:default-checkout-timeout 6
|
||||||
|
#:scheduler priority-scheduler)))
|
||||||
(resource-pool-default-timeout 6))
|
|
||||||
|
|
||||||
(let ((resource-pool-checkout-failures-metric
|
(let ((resource-pool-checkout-failures-metric
|
||||||
(make-counter-metric registry
|
(make-counter-metric registry
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue