File tree Expand file tree Collapse file tree 3 files changed +5
-2
lines changed Expand file tree Collapse file tree 3 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -89,7 +89,8 @@ addDefaults(config, {
89
89
max : 10 ,
90
90
idleTimeoutMillis : 10000 ,
91
91
maxTries : 3 ,
92
- fallbackOnFail : true
92
+ fallbackOnFail : true ,
93
+ stopRetryThreshold : 800
93
94
} ,
94
95
dumpDatabase : {
95
96
enabled : false ,
Original file line number Diff line number Diff line change @@ -148,7 +148,8 @@ export class Postgres implements IDatabase {
148
148
149
149
Logger . error ( `prepare (postgres) try ${ tries } : ${ err } ` ) ;
150
150
}
151
- } while ( this . isReadQuery ( type ) && tries < maxTries ( ) ) ;
151
+ } while ( this . isReadQuery ( type ) && tries < maxTries ( )
152
+ && this . activePostgresRequests < this . config . postgresReadOnly . stopRetryThreshold ) ;
152
153
153
154
this . activePostgresRequests -- ;
154
155
throw new Error ( `prepare (postgres): ${ type } ${ query } failed after ${ tries } tries` ) ;
Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ export interface CustomPostgresReadOnlyConfig extends CustomPostgresConfig {
21
21
weight : number ;
22
22
readTimeout : number ;
23
23
fallbackOnFail : boolean ;
24
+ stopRetryThreshold : number ;
24
25
}
25
26
26
27
export interface SBSConfig {
You can’t perform that action at this time.
0 commit comments