Example: process devices serially instead of in parallel

This commit is contained in:
Pascal Bourque
2025-11-28 08:43:23 -05:00
parent 181c9238da
commit 1b680b693f

View File

@@ -101,14 +101,12 @@ async function main() {
});
}
await Promise.all(
Object.entries(devices.DevicesObj).map(async ([deviceId, device]) => {
for (const [deviceId, device] of Object.entries(devices.DevicesObj)) {
const serial = await client.getDeviceSerialNumber(deviceId);
rootLogger.info(`Serial number for device '${deviceId}' (${device.Name ?? 'Unknown'}): ${serial}`);
await client.startRealtimeUpdates(deviceId);
})
);
}
}
main().catch((error) => {