Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

Commit

Permalink
feat: pubsub unsubscribe all (#956)
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
  • Loading branch information
alanshaw committed Mar 13, 2019
1 parent d1e99e7 commit a57a411
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .aegir.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ module.exports = {
},
karma: {
files: [{
pattern: 'node_modules/interface-ipfs-core/js/test/fixtures/**/*',
pattern: 'node_modules/interface-ipfs-core/test/fixtures/**/*',
watched: false,
served: true,
included: false
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@
"cross-env": "^5.2.0",
"dirty-chai": "^2.0.1",
"eslint-plugin-react": "^7.11.1",
"go-ipfs-dep": "~0.4.18",
"interface-ipfs-core": "~0.96.0",
"ipfsd-ctl": "github:ipfs/js-ipfsd-ctl",
"go-ipfs-dep": "~0.4.19",
"interface-ipfs-core": "~0.99.0",
"ipfsd-ctl": "~0.42.0",
"nock": "^10.0.2",
"pull-stream": "^3.6.9",
"stream-equal": "^1.1.1"
Expand Down
6 changes: 5 additions & 1 deletion src/pubsub.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,11 @@ module.exports = (arg) => {
return setImmediate(() => callback(err))
}

ps.removeListener(topic, handler)
if (!handler && !callback) {
ps.removeAllListeners(topic)
} else {
ps.removeListener(topic, handler)
}

// Drop the request once we are actually done
if (ps.listenerCount(topic) === 0) {
Expand Down
2 changes: 1 addition & 1 deletion test/get.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ describe('.get (specific go-ipfs features)', function () {

const smallFile = {
cid: 'Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP',
data: fixture('js/test/fixtures/testfile.txt')
data: fixture('test/fixtures/testfile.txt')
}

let ipfsd
Expand Down
4 changes: 4 additions & 0 deletions test/interface.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ describe('interface-ipfs-core tests', () => {
{
name: 'should get by CID string + path',
reason: 'FIXME vmx 2018-02-22: Currently not supported in go-ipfs, it might be possible once https://github.com/ipfs/go-ipfs/issues/4728 is done'
},
{
name: 'should get only a CID, due to resolving locally only',
reason: 'FIXME: go-ipfs does not support localResolve option'
}
]
})
Expand Down

0 comments on commit a57a411

Please sign in to comment.