File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -94,21 +94,23 @@ export class Telemetry {
9494 } ) ;
9595
9696 // Wait up to 5 seconds for events to be sent before closing, but don't throw if it times out
97- const flushTimeout = 5000 ;
97+ const flushMaxWaitTime = 5000 ;
98+ let flushTimeout : NodeJS . Timeout | undefined ;
9899 await Promise . race ( [
99100 new Promise < void > ( ( resolve ) => {
100- const timeout = setTimeout ( ( ) => {
101+ flushTimeout = setTimeout ( ( ) => {
101102 this . session . logger . debug ( {
102103 id : LogId . telemetryClose ,
103- message : `Failed to flush remaining events within ${ flushTimeout } ms timeout` ,
104+ message : `Failed to flush remaining events within ${ flushMaxWaitTime } ms timeout` ,
104105 context : "telemetry" ,
105106 } ) ;
106107 resolve ( ) ;
107- } , flushTimeout ) ;
108- timeout . unref ( ) ;
108+ } , flushMaxWaitTime ) ;
109109 } ) ,
110110 this . emit ( [ ] ) ,
111111 ] ) ;
112+
113+ flushTimeout ?. unref ( ) ;
112114 }
113115
114116 /**
You can’t perform that action at this time.
0 commit comments