File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import { FindCursor , AbstractCursor } from 'mongodb'
1+ import { AbstractCursor } from 'mongodb'
22
33export const LOG_PREFIX = '[Timeoutify]'
44
@@ -39,7 +39,10 @@ export class Timeoutify {
3939
4040 if ( timeoutMS > 0 ) {
4141 this . handle = setTimeout ( ( ) => {
42- this . logger . debug ( `${ this . logPrefix } setTimeout called` )
42+ if ( process . env . DEBUG ) {
43+ this . logger . debug ( `${ this . logPrefix } setTimeout called` )
44+ }
45+
4346 if ( ! this . abortController . signal . aborted ) {
4447 this . statusInternal = TimeoutifyStatus . TimedOut
4548 this . abortController . abort ( )
@@ -99,7 +102,9 @@ export class Timeoutify {
99102 * This ensures the MongoDB Operation is never running for longer than the timeout.
100103 * */
101104 async runMongoOpWithTimeout < T > ( cursor : AbstractCursor < T > ) : Promise < readonly T [ ] > {
102- this . logger . debug ( `${ this . logPrefix } runMongoOpWithTimeout called` )
105+ if ( process . env . DEBUG ) {
106+ this . logger . debug ( `${ this . logPrefix } runMongoOpWithTimeout called` )
107+ }
103108 if ( this . status === TimeoutifyStatus . Aborted || this . status === TimeoutifyStatus . TimedOut ) {
104109 throw new Error ( `${ this . logPrefix } runMongoOpWithTimeout: AbortSignal already aborted` )
105110 }
You can’t perform that action at this time.
0 commit comments