@@ -83,7 +83,7 @@ export interface SubscriberCloseOptions {
8383 * Specifies how long before the final close timeout, in WaitForProcessing mode,
8484 * that we should give up and start shutting down cleanly.
8585 */
86- const finalNackTimeout = Duration . from ( { seconds : 1 } ) ;
86+ const FINAL_NACK_TIMEOUT = Duration . from ( { seconds : 1 } ) ;
8787
8888/**
8989 * Thrown when an error is detected in an ack/nack/modack call, when
@@ -982,13 +982,13 @@ export class Subscriber extends EventEmitter {
982982 ) ;
983983
984984 // If the user specified a zero timeout, just bail immediately.
985- if ( Math . floor ( timeout . milliseconds ) === 0 ) {
985+ if ( ! timeout . milliseconds ) {
986986 this . _inventory . clear ( ) ;
987987 return ;
988988 }
989989
990990 // Warn the user if the timeout is too short for NackImmediately.
991- if ( Duration . compare ( timeout , finalNackTimeout ) < 0 ) {
991+ if ( Duration . compare ( timeout , FINAL_NACK_TIMEOUT ) < 0 ) {
992992 logs . debug . warn (
993993 'Subscriber.close() timeout is less than the final shutdown time (%i ms). This may result in lost nacks.' ,
994994 timeout . milliseconds ,
@@ -1002,7 +1002,7 @@ export class Subscriber extends EventEmitter {
10021002 behavior === SubscriberCloseBehaviors . WaitForProcessing &&
10031003 ! this . _inventory . isEmpty
10041004 ) {
1005- const waitTimeout = timeout . subtract ( finalNackTimeout ) ;
1005+ const waitTimeout = timeout . subtract ( FINAL_NACK_TIMEOUT ) ;
10061006
10071007 const emptyPromise = new Promise < void > ( r => {
10081008 this . _inventory . on ( 'empty' , r ) ;
0 commit comments