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

[WIP] fix: unsubscribe in series for go-ipfs #326

Merged
merged 2 commits into from
Jul 16, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/each')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually using async/each here and not eachSeries. There is a typo on one side :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ha thanks

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