Skip to content

Commit

Permalink
Merge pull request #230 from ycouble/master
Browse files Browse the repository at this point in the history
fix: allow numRetries = 0
  • Loading branch information
jasonbosco authored Oct 3, 2024
2 parents 4fcc75c + 9bd5184 commit 5f0e942
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
8 changes: 5 additions & 3 deletions src/Typesense/ApiCall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,9 +313,11 @@ export default class ApiCall {
}"`,
);
// this.logger.debug(error.stack)
this.logger.warn(
`Request #${requestNumber}: Sleeping for ${this.retryIntervalSeconds}s and then retrying request...`,
);
if (numTries < this.numRetriesPerRequest + 1) {
this.logger.warn(
`Request #${requestNumber}: Sleeping for ${this.retryIntervalSeconds}s and then retrying request...`,
);
}
await this.timer(this.retryIntervalSeconds);
} finally {
if (abortSignal && abortListener) {
Expand Down
6 changes: 3 additions & 3 deletions src/Typesense/Configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ export default class Configuration {
options.connectionTimeoutSeconds || options.timeoutSeconds || 5;
this.healthcheckIntervalSeconds = options.healthcheckIntervalSeconds || 60;
this.numRetries =
options.numRetries ||
this.nodes.length + (this.nearestNode == null ? 0 : 1) ||
3;
(options.numRetries !== undefined && options.numRetries >= 0
? options.numRetries
: this.nodes.length + (this.nearestNode == null ? 0 : 1)) || 3;
this.retryIntervalSeconds = options.retryIntervalSeconds || 0.1;

this.apiKey = options.apiKey;
Expand Down

0 comments on commit 5f0e942

Please sign in to comment.