Remove idb device polling record
Summary: If listing devices is successful, then don't record the event as this is triggered every X amount of seconds. Reviewed By: antonk52 Differential Revision: D47995681 fbshipit-source-id: 2d0fa68fd7b9c4ce74bad9e8cc0296691d9b8880
This commit is contained in:
committed by
Facebook GitHub Bot
parent
3b99e386a2
commit
f93da44ee5
@@ -28,6 +28,7 @@ export type IdbConfig = {
|
|||||||
// Use debug to get helpful logs when idb fails
|
// Use debug to get helpful logs when idb fails
|
||||||
const IDB_LOG_LEVEL = 'DEBUG';
|
const IDB_LOG_LEVEL = 'DEBUG';
|
||||||
const LOG_TAG = 'iOSContainerUtility';
|
const LOG_TAG = 'iOSContainerUtility';
|
||||||
|
const CMD_RECORD_THROTTLE_COUNT = 10;
|
||||||
|
|
||||||
const mutex = new Mutex();
|
const mutex = new Mutex();
|
||||||
|
|
||||||
@@ -49,6 +50,10 @@ export type DeviceTarget = {
|
|||||||
name: string;
|
name: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let idbDeviceListing = 0;
|
||||||
|
let idbCompanionDeviceListing = 0;
|
||||||
|
let xcodeDeviceListing = 0;
|
||||||
|
|
||||||
async function isAvailable(idbPath: string): Promise<boolean> {
|
async function isAvailable(idbPath: string): Promise<boolean> {
|
||||||
if (!idbPath) {
|
if (!idbPath) {
|
||||||
return false;
|
return false;
|
||||||
@@ -88,12 +93,17 @@ async function queryTargetsWithXcode(
|
|||||||
});
|
});
|
||||||
throw new Error('No output from command');
|
throw new Error('No output from command');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
xcodeDeviceListing++;
|
||||||
|
if (xcodeDeviceListing % CMD_RECORD_THROTTLE_COUNT === 0) {
|
||||||
recorder.event('cmd', {
|
recorder.event('cmd', {
|
||||||
cmd,
|
cmd,
|
||||||
description,
|
description,
|
||||||
success: true,
|
success: true,
|
||||||
context,
|
context,
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return stdout
|
return stdout
|
||||||
.toString()
|
.toString()
|
||||||
.split('\n')
|
.split('\n')
|
||||||
@@ -141,12 +151,15 @@ async function queryTargetsWithIdb(
|
|||||||
throw new Error('No output from command');
|
throw new Error('No output from command');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
idbDeviceListing++;
|
||||||
|
if (idbDeviceListing % CMD_RECORD_THROTTLE_COUNT === 0) {
|
||||||
recorder.event('cmd', {
|
recorder.event('cmd', {
|
||||||
cmd,
|
cmd,
|
||||||
description,
|
description,
|
||||||
success: true,
|
success: true,
|
||||||
context,
|
context,
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return parseIdbTargets(stdout.toString());
|
return parseIdbTargets(stdout.toString());
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -187,12 +200,15 @@ async function queryTargetsWithIdbCompanion(
|
|||||||
throw new Error('No output from command');
|
throw new Error('No output from command');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
idbCompanionDeviceListing++;
|
||||||
|
if (idbCompanionDeviceListing % CMD_RECORD_THROTTLE_COUNT === 0) {
|
||||||
recorder.event('cmd', {
|
recorder.event('cmd', {
|
||||||
cmd,
|
cmd,
|
||||||
description,
|
description,
|
||||||
success: true,
|
success: true,
|
||||||
context,
|
context,
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
const devices = parseIdbTargets(stdout.toString());
|
const devices = parseIdbTargets(stdout.toString());
|
||||||
if (devices.length > 0 && !isPhysicalDeviceEnabled) {
|
if (devices.length > 0 && !isPhysicalDeviceEnabled) {
|
||||||
|
|||||||
Reference in New Issue
Block a user