From 3c357e7e957f550b22eabfb2d27741d84183ebc5 Mon Sep 17 00:00:00 2001 From: Eli Bosley Date: Tue, 4 Feb 2025 14:29:22 -0500 Subject: [PATCH] fix: use batchProcess --- api/src/core/modules/get-disks.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/api/src/core/modules/get-disks.ts b/api/src/core/modules/get-disks.ts index d6e33be83..7295c5839 100644 --- a/api/src/core/modules/get-disks.ts +++ b/api/src/core/modules/get-disks.ts @@ -5,6 +5,7 @@ import { blockDevices, diskLayout } from 'systeminformation'; import type { Disk } from '@app/graphql/generated/api/types'; import { graphqlLogger } from '@app/core/log'; import { DiskFsType, DiskInterfaceType, DiskSmartStatus } from '@app/graphql/generated/api/types'; +import { batchProcess } from '@app/utils'; const getTemperature = async (disk: Systeminformation.DiskLayoutData): Promise => { try { @@ -82,9 +83,9 @@ export const getDisks = async (options?: { temperature: boolean }): Promise devices.filter((device) => device.type === 'part') ); - const disks = await Promise.all( - (await diskLayout()).map((disk) => parseDisk(disk, partitions, true)) - ); - return disks; + const { data } = await batchProcess(await diskLayout(), async (disk) => + parseDisk(disk, partitions, true) + ); + return data; };