Skip to content

Commit

Permalink
fix: allow ConsumerOptions of type number to be zero
Browse files Browse the repository at this point in the history
Fixes: #223

Uses nullish coalescing introduced in Typescript 3.7: https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#nullish-coalescing

Nullish coalescing is not applied to `batchSize` as zero is not a reasonable value for `batchSize`.
  • Loading branch information
Peter Prins authored and Martin Buckley committed Apr 14, 2022
1 parent 1cef3ca commit 8fed996
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/consumer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,9 @@ export class Consumer extends EventEmitter {
this.visibilityTimeout = options.visibilityTimeout;
this.terminateVisibilityTimeout = options.terminateVisibilityTimeout || false;
this.heartbeatInterval = options.heartbeatInterval;
this.waitTimeSeconds = options.waitTimeSeconds || 20;
this.authenticationErrorTimeout = options.authenticationErrorTimeout || 10000;
this.pollingWaitTimeMs = options.pollingWaitTimeMs || 0;
this.waitTimeSeconds = options.waitTimeSeconds ?? 20;
this.authenticationErrorTimeout = options.authenticationErrorTimeout ?? 10000;
this.pollingWaitTimeMs = options.pollingWaitTimeMs ?? 0;
this.shouldDeleteMessages = options.shouldDeleteMessages ?? true;

this.sqs = options.sqs || new SQS({
Expand Down

0 comments on commit 8fed996

Please sign in to comment.