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;
1818 * ```
1919 */
2020export async function getDeviceIdForConnection ( ) : Promise < string > {
21+ const controller = new AbortController ( ) ;
22+ const timeoutId = setTimeout ( ( ) => controller . abort ( ) , DEVICE_ID_TIMEOUT ) ;
23+
2124 try {
2225 const deviceId = await getDeviceId ( {
2326 getMachineId : ( ) => nodeMachineId . machineId ( true ) ,
@@ -34,10 +37,12 @@ export async function getDeviceIdForConnection(): Promise<string> {
3437 break ;
3538 }
3639 } ,
37- abortSignal : abortSignal || controller . signal ,
40+ abortSignal : controller . signal ,
3841 } ) ;
42+ clearTimeout ( timeoutId ) ;
3943 return deviceId ;
4044 } catch ( error ) {
45+ clearTimeout ( timeoutId ) ;
4146 logger . debug ( LogId . telemetryDeviceIdFailure , "deviceId" , `Failed to get device ID: ${ String ( error ) } ` ) ;
4247 return "unknown" ;
4348 }
You can’t perform that action at this time.
0 commit comments