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

Commit

Permalink
fix: unsubscribe in series for go-ipfs (#326)
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Alan Shaw <[email protected]>
  • Loading branch information
alanshaw authored Jul 16, 2018
1 parent 87a8f96 commit 8e487da
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions js/src/pubsub/ls.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* eslint-env mocha */
'use strict'

const each = require('async/each')
const eachSeries = require('async/eachSeries')
const { getTopic } = require('./utils')
const { getDescribe, getIt, expect } = require('../utils/mocha')
Expand Down Expand Up @@ -80,7 +79,7 @@ module.exports = (createCommon, options) => {
expect(list.sort())
.to.eql(topics.map((t) => t.name).sort())

each(topics, (t, cb) => {
eachSeries(topics, (t, cb) => {
ipfs.pubsub.unsubscribe(t.name, t.handler, cb)
}, done)
})
Expand Down
4 changes: 2 additions & 2 deletions js/src/pubsub/unsubscribe.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-env mocha */
'use strict'

const each = require('async/each')
const eachSeries = require('async/eachSeries')
const timesSeries = require('async/timesSeries')
const { getTopic } = require('./utils')
const { getDescribe, getIt, expect } = require('../utils/mocha')
Expand Down Expand Up @@ -42,7 +42,7 @@ module.exports = (createCommon, options) => {
ipfs.pubsub.subscribe(someTopic, handler, (err) => cb(err, handler))
}, (err, handlers) => {
expect(err).to.not.exist()
each(
eachSeries(
handlers,
(handler, cb) => ipfs.pubsub.unsubscribe(someTopic, handler, cb),
(err) => {
Expand Down

0 comments on commit 8e487da

Please sign in to comment.