From 393391a1fdcfcc71d91177998fea2f1c72aae90c Mon Sep 17 00:00:00 2001 From: haad Date: Wed, 13 Apr 2016 10:38:27 +0200 Subject: [PATCH] Remove bluebird dependency, fix tests --- package.json | 4 ++-- src/OrbitDB.js | 12 +++++------- test/client.test.js | 2 +- test/orbit-db.test.js | 4 ++-- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 122a351..d5f05b6 100644 --- a/package.json +++ b/package.json @@ -13,9 +13,8 @@ }, "main": "src/Client.js", "dependencies": { - "ipfs-log": "^1.1.4", + "ipfs-log": "^1.1.5", "lazy.js": "^0.4.2", - "lodash": "^4.3.0", "log4js": "^0.6.33", "orbit-common": "^0.2.4", "socket.io-client": "^1.4.5" @@ -23,6 +22,7 @@ "devDependencies": { "asyncawait": "^1.0.1", "eslint": "^2.3.0", + "lodash": "^4.3.0", "mocha": "^2.3.4" }, "scripts": { diff --git a/src/OrbitDB.js b/src/OrbitDB.js index d19d6fb..7572127 100644 --- a/src/OrbitDB.js +++ b/src/OrbitDB.js @@ -2,7 +2,6 @@ const Lazy = require('lazy.js'); const EventEmitter = require('events').EventEmitter; -const Promise = require('bluebird'); const logger = require('orbit-common/lib/logger')("orbit-db.OrbitDB"); const Log = require('ipfs-log'); const DBOperation = require('./db/Operation'); @@ -139,12 +138,11 @@ class OrbitDB { .map((f) => f.payload) .filter((f) => Lazy(this._cached).find((e) => e.hash === f.payload) === undefined); - Promise.map(payloadHashes, (f) => OrbitDB.fetchPayload(this._ipfs, f), { concurrency: 4 }) - .then((payloads) => { - payloads.forEach((f) => this._cached.push(f)); - resolve(); - }) - .catch(reject); + const promises = payloadHashes.map((f) => OrbitDB.fetchPayload(this._ipfs, f)); + Promise.all(promises).then((payloads) => { + payloads.forEach((f) => this._cached.push(f)); + resolve(); + }).catch(reject); }); } diff --git a/test/client.test.js b/test/client.test.js index 76add68..79ab7f9 100644 --- a/test/client.test.js +++ b/test/client.test.js @@ -15,7 +15,7 @@ const username = 'testrunner'; const password = ''; describe('Orbit Client', function() { - this.timeout(2000); + this.timeout(20000); let client, db; let channel = 'abcdefgh'; diff --git a/test/orbit-db.test.js b/test/orbit-db.test.js index d33fbb7..b9f4c16 100644 --- a/test/orbit-db.test.js +++ b/test/orbit-db.test.js @@ -11,7 +11,7 @@ const OrbitDB = require('../src/OrbitDB'); const Log = require('ipfs-log'); // Mute logging -// require('log4js').setGlobalLogLevel('ERROR'); +require('log4js').setGlobalLogLevel('ERROR'); // Orbit const username = 'testrunner'; @@ -19,7 +19,7 @@ const password = ''; const user = { username: username }; describe('OrbitDB', function() { - this.timeout(2000); + this.timeout(20000); let db, ipfs; let channel = 'orbit-db.test';