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 {
94
94
} ) ;
95
95
96
96
// 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 ;
98
99
await Promise . race ( [
99
100
new Promise < void > ( ( resolve ) => {
100
- const timeout = setTimeout ( ( ) => {
101
+ flushTimeout = setTimeout ( ( ) => {
101
102
this . session . logger . debug ( {
102
103
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` ,
104
105
context : "telemetry" ,
105
106
} ) ;
106
107
resolve ( ) ;
107
- } , flushTimeout ) ;
108
- timeout . unref ( ) ;
108
+ } , flushMaxWaitTime ) ;
109
109
} ) ,
110
110
this . emit ( [ ] ) ,
111
111
] ) ;
112
+
113
+ flushTimeout ?. unref ( ) ;
112
114
}
113
115
114
116
/**
You can’t perform that action at this time.
0 commit comments