Skip to content

Commit 94ca291

Browse files
committed
Don't cut off early if last retry
1 parent e84957a commit 94ca291

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/databases/Postgres.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ export class Postgres implements IDatabase {
113113

114114
pendingQueries.push(savePromiseState(lastPool.query({ text: query, values: params })));
115115
const currentPromises = [...pendingQueries];
116-
if (options.useReplica) currentPromises.push(savePromiseState(timeoutPomise(this.config.postgresReadOnly.readTimeout)));
116+
if (options.useReplica && maxTries() - tries > 1) currentPromises.push(savePromiseState(timeoutPomise(this.config.postgresReadOnly.readTimeout)));
117117
const queryResult = await nextFulfilment(currentPromises);
118118

119119
switch (type) {

0 commit comments

Comments
 (0)