Use idb to poll for devices, if it is installed
Summary: Bringing the pkd CPU usage fix to open source releases. Now when idb is installed, Flipper will always use it to check for devices, and only fallback to instruments if not. Fixes https://github.com/facebook/flipper/issues/1028 Reviewed By: passy Differential Revision: D23293675 fbshipit-source-id: 6ff3e89167f5f6d4130f197b2a675202334d0e7d
This commit is contained in:
committed by
Facebook GitHub Bot
parent
573bf8a940
commit
39a465b8b8
@@ -59,8 +59,12 @@ async function targets(idbPath: string): Promise<Array<DeviceTarget>> {
|
|||||||
if (process.platform !== 'darwin') {
|
if (process.platform !== 'darwin') {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
if (GK.get('flipper_use_idb_to_list_devices')) {
|
|
||||||
await memoize(checkIdbIsInstalled)(idbPath);
|
// Not all users have idb installed because you can still use
|
||||||
|
// Flipper with Simulators without it.
|
||||||
|
// But idb is MUCH more CPU efficient than instruments, so
|
||||||
|
// when installed, use it.
|
||||||
|
if (await memoize(isAvailable)(idbPath)) {
|
||||||
return safeExec(`${idbPath} list-targets --json`).then(({stdout}) =>
|
return safeExec(`${idbPath} list-targets --json`).then(({stdout}) =>
|
||||||
stdout
|
stdout
|
||||||
.toString()
|
.toString()
|
||||||
|
|||||||
Reference in New Issue
Block a user