Skip to content
This repository was archived by the owner on Aug 11, 2021. It is now read-only.

Commit f256451

Browse files
fix(block-service): limit all async calls
1 parent a79f650 commit f256451

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Diff for: src/block-service.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ function BlockService (ipfsRepo, exchange) {
2020
return callback(new Error('expects an array of Blocks'))
2121
}
2222

23-
async.each(blocks, (block, next) => {
23+
async.eachLimit(blocks, 100, (block, next) => {
2424
this.addBlock(block, next)
2525
}, callback)
2626
}
@@ -54,7 +54,7 @@ function BlockService (ipfsRepo, exchange) {
5454

5555
var results = {}
5656

57-
async.each(multihashes, (multihash, next) => {
57+
async.eachLimit(multihashes, 100, (multihash, next) => {
5858
this.getBlock(multihash, extension, (err, block) => {
5959
results[multihash] = {
6060
err: err,
@@ -90,7 +90,7 @@ function BlockService (ipfsRepo, exchange) {
9090
return callback(new Error('Invalid batch of multihashes'))
9191
}
9292

93-
async.each(multihashes, (multihash, next) => {
93+
async.eachLimit(multihashes, 100, (multihash, next) => {
9494
this.deleteBlock(multihash, extension, next)
9595
}, (err) => {
9696
callback(err)

0 commit comments

Comments
 (0)