mirror of
https://github.com/bourquep/mysa-js-sdk.git
synced 2026-02-04 01:31:05 +00:00
Example: process devices serially instead of in parallel
This commit is contained in:
@@ -101,14 +101,12 @@ async function main() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
await Promise.all(
|
for (const [deviceId, device] of Object.entries(devices.DevicesObj)) {
|
||||||
Object.entries(devices.DevicesObj).map(async ([deviceId, device]) => {
|
const serial = await client.getDeviceSerialNumber(deviceId);
|
||||||
const serial = await client.getDeviceSerialNumber(deviceId);
|
rootLogger.info(`Serial number for device '${deviceId}' (${device.Name ?? 'Unknown'}): ${serial}`);
|
||||||
rootLogger.info(`Serial number for device '${deviceId}' (${device.Name ?? 'Unknown'}): ${serial}`);
|
|
||||||
|
|
||||||
await client.startRealtimeUpdates(deviceId);
|
await client.startRealtimeUpdates(deviceId);
|
||||||
})
|
}
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
main().catch((error) => {
|
main().catch((error) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user