Log when client connects for an unknown device

Summary:
We've seen this happen sometimes, e.g. when adb fails and we aren't showing any android devices, but the sdk still manages to connect.

When we detect this, log an error so we can track how often it occurs.

Reviewed By: passy

Differential Revision: D13175639

fbshipit-source-id: b0f79b77ac04ad804e56448b3696a3ffeb30631e
This commit is contained in:
John Knox
2018-11-23 06:31:01 -08:00
committed by Facebook Github Bot
parent 1c1905b5a8
commit d8d40ae49b

View File

@@ -226,6 +226,16 @@ export default function reducer(
selectedPlugin = userPreferredPlugin; selectedPlugin = userPreferredPlugin;
} }
const matchingDeviceForClient = state.devices.filter(
device => payload.query.device_id === device.serial,
);
if (matchingDeviceForClient.length === 0) {
console.error(
new RecurringError(`Client initialised for non-displayed device`),
payload.id,
);
}
return { return {
...state, ...state,
clients: state.clients.concat(payload), clients: state.clients.concat(payload),