From 39a465b8b802b34d019b666f6cb1111853f974a2 Mon Sep 17 00:00:00 2001 From: John Knox Date: Mon, 24 Aug 2020 07:51:58 -0700 Subject: [PATCH] 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 --- desktop/app/src/utils/iOSContainerUtility.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/desktop/app/src/utils/iOSContainerUtility.tsx b/desktop/app/src/utils/iOSContainerUtility.tsx index cbb1cb742..735ced92b 100644 --- a/desktop/app/src/utils/iOSContainerUtility.tsx +++ b/desktop/app/src/utils/iOSContainerUtility.tsx @@ -59,8 +59,12 @@ async function targets(idbPath: string): Promise> { if (process.platform !== 'darwin') { 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}) => stdout .toString()