Comparing version 1.3.2 to 1.3.3
{ | ||
"name": "ipfs-log", | ||
"version": "1.3.2", | ||
"version": "1.3.3", | ||
"description": "Append-only log for IPFS", | ||
@@ -9,2 +9,3 @@ "main": "src/log.js", | ||
"dependencies": { | ||
"bluebird": "^3.3.5", | ||
"buffer": "^4.5.1", | ||
@@ -11,0 +12,0 @@ "lazy.js": "^0.4.2", |
@@ -8,2 +8,3 @@ 'use strict'; | ||
const Node = require('./node'); | ||
const Promise = require('bluebird'); | ||
@@ -20,2 +21,3 @@ const MaxBatchSize = 10; // How many items to keep per local batch | ||
this.options = opts || { maxHistory: MaxHistory }; | ||
if(!this.options.maxHistory) this.options.maxHistory = MaxHistory; | ||
this._currentBatch = []; | ||
@@ -57,12 +59,14 @@ this._heads = []; | ||
const nexts = _.flatten(other.items.map((f) => f.next)); | ||
const promises = nexts.map((f) => { | ||
return Promise.map(nexts, (f) => { | ||
let all = this.items.map((a) => a.hash); | ||
return this._fetchRecursive(this._ipfs, f, all, this.options.maxHistory, 0) | ||
.then((history) => { | ||
history.forEach((b) => this._insert(b)); | ||
this._heads = Log.findHeads(this); | ||
return history; | ||
let h = _.differenceWith(history, this._items, Node.equals); | ||
h.forEach((b) => this._insert(b)); | ||
return h; | ||
}); | ||
}); | ||
return Promise.all(promises).then((r) => _.flatten(r.concat(diff))) | ||
}, { concurrency: 1 }).then((r) => { | ||
this._heads = Log.findHeads(this); | ||
return _.flatten(r).concat(diff) | ||
}) | ||
} | ||
@@ -96,2 +100,3 @@ | ||
// If the given hash is in the given log (all) or if we're at maximum depth, return | ||
@@ -107,4 +112,4 @@ if(isReferenced(all, hash) || depth >= amount) | ||
const promises = node.next.map((f) => this._fetchRecursive(ipfs, f, all, amount, depth)); | ||
return Promise.all(promises).then((res) => _.flatten(res.concat(result))); | ||
return Promise.map(node.next, (f) => this._fetchRecursive(ipfs, f, all, amount, depth), { concurrency: 1 }) | ||
.then((res) => _.flatten(res.concat(result))) | ||
}); | ||
@@ -111,0 +116,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1761871
47071
4
+ Addedbluebird@^3.3.5
+ Addedbluebird@3.7.2(transitive)