File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,9 @@ export const DEVICE_ID_TIMEOUT = 3000;
18
18
* ```
19
19
*/
20
20
export async function getDeviceIdForConnection ( ) : Promise < string > {
21
+ const controller = new AbortController ( ) ;
22
+ const timeoutId = setTimeout ( ( ) => controller . abort ( ) , DEVICE_ID_TIMEOUT ) ;
23
+
21
24
try {
22
25
const deviceId = await getDeviceId ( {
23
26
getMachineId : ( ) => nodeMachineId . machineId ( true ) ,
@@ -34,10 +37,12 @@ export async function getDeviceIdForConnection(): Promise<string> {
34
37
break ;
35
38
}
36
39
} ,
37
- abortSignal : abortSignal || controller . signal ,
40
+ abortSignal : controller . signal ,
38
41
} ) ;
42
+ clearTimeout ( timeoutId ) ;
39
43
return deviceId ;
40
44
} catch ( error ) {
45
+ clearTimeout ( timeoutId ) ;
41
46
logger . debug ( LogId . telemetryDeviceIdFailure , "deviceId" , `Failed to get device ID: ${ String ( error ) } ` ) ;
42
47
return "unknown" ;
43
48
}
You can’t perform that action at this time.
0 commit comments