Commit ea79024 1 parent 22716fc commit ea79024 Copy full SHA for ea79024
File tree 1 file changed +15
-1
lines changed
1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ use graph::cheap_clone::CheapClone;
10
10
use graph:: constraint_violation;
11
11
use graph:: prelude:: tokio;
12
12
use graph:: prelude:: tokio:: time:: Instant ;
13
+ use graph:: slog:: warn;
13
14
use graph:: util:: timed_rw_lock:: TimedMutex ;
14
15
use graph:: {
15
16
prelude:: {
@@ -727,12 +728,25 @@ impl PoolInner {
727
728
728
729
// Connect to Postgres
729
730
let conn_manager = ConnectionManager :: new ( postgres_url. clone ( ) ) ;
731
+ let min_idle = ENV_VARS . store . connection_min_idle . filter ( |min_idle| {
732
+ if * min_idle <= pool_size {
733
+ true
734
+ } else {
735
+ warn ! (
736
+ logger_pool,
737
+ "Configuration error: min idle {} exceeds pool size {}, ignoring min idle" ,
738
+ min_idle,
739
+ pool_size
740
+ ) ;
741
+ false
742
+ }
743
+ } ) ;
730
744
let builder: Builder < ConnectionManager < PgConnection > > = Pool :: builder ( )
731
745
. error_handler ( error_handler. clone ( ) )
732
746
. event_handler ( event_handler. clone ( ) )
733
747
. connection_timeout ( ENV_VARS . store . connection_timeout )
734
748
. max_size ( pool_size)
735
- . min_idle ( ENV_VARS . store . connection_min_idle )
749
+ . min_idle ( min_idle )
736
750
. idle_timeout ( Some ( ENV_VARS . store . connection_idle_timeout ) ) ;
737
751
let pool = builder. build_unchecked ( conn_manager) ;
738
752
let fdw_pool = fdw_pool_size. map ( |pool_size| {
You can’t perform that action at this time.
0 commit comments