Skip to content

Commit 4848b15

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

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
"benchmark": "^2.1.4",
4949
"chai": "^4.2.0",
5050
"dirty-chai": "^2.0.1",
51-
"ipfs-repo": "ipfs/js-ipfs-repo#blockstore-accept-async-iterator",
51+
"ipfs-repo": "^0.28.0",
5252
"libp2p": "^0.26.1",
5353
"libp2p-kad-dht": "^0.16.0",
5454
"libp2p-mplex": "^0.8.0",

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)