Skip to content

Commit ea846e5

Browse files
committed
chore: wrap list of tasks in promise.all
1 parent 9bb5ea5 commit ea846e5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/decision-engine/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ class DecisionEngine {
8282
const groupedTasks = groupBy(task => task.target.toB58String(), tasks)
8383

8484
const blocks = await Promise.all(uniqCids.map(cid => this.blockstore.get(cid)))
85-
await Object.values(groupedTasks).map(async (tasks) => {
85+
86+
await Promise.all(Object.values(groupedTasks).map(async (tasks) => {
8687
// all tasks in the group have the same target
8788
const peer = tasks[0].target
8889
const blockList = cids.map((cid) => blocks.find(b => b.cid.equals(cid)))
@@ -97,7 +98,7 @@ class DecisionEngine {
9798
for (const block of blockList) {
9899
this.messageSent(peer, block)
99100
}
100-
})
101+
}))
101102

102103
this._tasks = []
103104
}

0 commit comments

Comments
 (0)