From 63cd03b3547791aca6d4d90ccf5660ac382f2a8f Mon Sep 17 00:00:00 2001 From: Alan Shaw Date: Mon, 8 Jan 2018 11:00:03 +0000 Subject: [PATCH 1/2] fixes timeout ms arg being erroneously passed to pubsub.peers --- src/pubsub.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/pubsub.js b/src/pubsub.js index 856d2a5fd..d9e40f96d 100644 --- a/src/pubsub.js +++ b/src/pubsub.js @@ -298,16 +298,15 @@ module.exports = (common) => { (cb) => ipfs3.pubsub.subscribe(topicOther, sub3, cb) ], (err) => { expect(err).to.not.exist() - setTimeout(() => { - ipfs1.pubsub.peers(topic, (err, peers) => { - expect(err).to.not.exist() - expect(peers).to.be.empty() - ipfs1.pubsub.unsubscribe(topic, sub1) - ipfs2.pubsub.unsubscribe(topicOther, sub2) - ipfs3.pubsub.unsubscribe(topicOther, sub3) - done() - }, 10000) + ipfs1.pubsub.peers(topic, (err, peers) => { + expect(err).to.not.exist() + + expect(peers).to.be.empty() + ipfs1.pubsub.unsubscribe(topic, sub1) + ipfs2.pubsub.unsubscribe(topicOther, sub2) + ipfs3.pubsub.unsubscribe(topicOther, sub3) + done() }) }) }) From c23bb6caf85c66b42b18d3fabe667579e380accd Mon Sep 17 00:00:00 2001 From: Alan Shaw Date: Mon, 8 Jan 2018 11:00:22 +0000 Subject: [PATCH 2/2] fixes typo in spec docs --- SPEC/PUBSUB.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SPEC/PUBSUB.md b/SPEC/PUBSUB.md index 6ce6cab68..d27fa788d 100644 --- a/SPEC/PUBSUB.md +++ b/SPEC/PUBSUB.md @@ -12,7 +12,7 @@ pubsub API - `topic: string` - `options: Object` - (Optional), might contain the following properties: - `discover`: type: Boolean - Will use the DHT to find other peers. -- `handler: (msg) => ()` - Event handler which will be called with a message object everytime one is received. The `msg` has the format `{from: string, seqno: Buffer, data: Buffer, topicCIDs: Array}`. +- `handler: (msg) => ()` - Event handler which will be called with a message object everytime one is received. The `msg` has the format `{from: string, seqno: Buffer, data: Buffer, topicIDs: Array}`. - `callback: (Error) => ()` (Optional) Called once the subscription is established. If no `callback` is passed, a [promise][] is returned.