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

fix(block-service): limit all async calls #15

Merged
merged 1 commit into from
Apr 24, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/block-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function BlockService (ipfsRepo, exchange) {
return callback(new Error('expects an array of Blocks'))
}

async.each(blocks, (block, next) => {
async.eachLimit(blocks, 100, (block, next) => {
this.addBlock(block, next)
}, callback)
}
Expand Down Expand Up @@ -54,7 +54,7 @@ function BlockService (ipfsRepo, exchange) {

var results = {}

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

async.each(multihashes, (multihash, next) => {
async.eachLimit(multihashes, 100, (multihash, next) => {
this.deleteBlock(multihash, extension, next)
}, (err) => {
callback(err)
Expand Down