From 1b680b693f76470130831d734f675ebc0721f47f Mon Sep 17 00:00:00 2001 From: Pascal Bourque Date: Fri, 28 Nov 2025 08:43:23 -0500 Subject: [PATCH] Example: process devices serially instead of in parallel --- example/main.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/example/main.ts b/example/main.ts index d271bc7..362e1ba 100644 --- a/example/main.ts +++ b/example/main.ts @@ -101,14 +101,12 @@ async function main() { }); } - await Promise.all( - Object.entries(devices.DevicesObj).map(async ([deviceId, device]) => { - const serial = await client.getDeviceSerialNumber(deviceId); - rootLogger.info(`Serial number for device '${deviceId}' (${device.Name ?? 'Unknown'}): ${serial}`); + 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); - }) - ); + await client.startRealtimeUpdates(deviceId); + } } main().catch((error) => {