Skip to content

Commit

Permalink
add parallel promises
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanzhouyc authored and paulr34 committed Nov 22, 2024
1 parent 836fd2a commit 1da11bf
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src-electron/rest/user-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,25 +111,23 @@ async function getEndpointTypeElements(
endpointTypeClusterId,
deviceTypeClusterId
) {
let elements = {}
elements.attributes =
await queryAttribute.selectAttributesByEndpointTypeClusterId(
let [attributes, commands, events] = await Promise.all([
queryAttribute.selectAttributesByEndpointTypeClusterId(
db,
endpointTypeClusterId
)
elements.commands =
await queryCommand.selectCommandsByEndpointTypeClusterIdAndDeviceTypeClusterId(
),
queryCommand.selectCommandsByEndpointTypeClusterIdAndDeviceTypeClusterId(
db,
endpointTypeClusterId,
deviceTypeClusterId
)
elements.events =
await queryEvent.selectEventsByEndpointTypeClusterIdAndDeviceTypeClusterId(
),
queryEvent.selectEventsByEndpointTypeClusterIdAndDeviceTypeClusterId(
db,
endpointTypeClusterId,
deviceTypeClusterId
)
return elements
])
return { attributes, commands, events }
}

/**
Expand Down

0 comments on commit 1da11bf

Please sign in to comment.