Skip to content

Commit

Permalink
chore: Rename beganWaitingForStop to stopRequestedAtTimestamp
Browse files Browse the repository at this point in the history
  • Loading branch information
barwin committed Jan 30, 2024
1 parent bac202c commit bbfb1cc
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/consumer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export class Consumer extends TypedEventEmitter {
private pollingCompleteWaitTimeMs: number;
private heartbeatInterval: number;
private isPolling: boolean;
private beganWaitingForStop: number;
private stopRequestedAtTimestamp: number;
public abortController: AbortController;

constructor(options: ConsumerOptions) {
Expand Down Expand Up @@ -146,7 +146,7 @@ export class Consumer extends TypedEventEmitter {
this.emit('aborted');
}

this.beganWaitingForStop = Date.now();
this.stopRequestedAtTimestamp = Date.now();
this.waitForPollingToComplete();
}

Expand All @@ -161,7 +161,8 @@ export class Consumer extends TypedEventEmitter {
}

const exceededTimeout =
Date.now() - this.beganWaitingForStop > this.pollingCompleteWaitTimeMs;
Date.now() - this.stopRequestedAtTimestamp >
this.pollingCompleteWaitTimeMs;
if (exceededTimeout) {
logger.debug('waiting_for_polling_to_complete_timeout_exceeded');
this.emit('stopped');
Expand Down

0 comments on commit bbfb1cc

Please sign in to comment.