Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: pubsub flag defaults #363

Merged
merged 1 commit into from
Sep 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
"dirty-chai": "^2.0.1",
"go-ipfs-dep": "~0.4.22",
"husky": "^3.0.4",
"ipfs": "~0.37.1",
"ipfs": "ipfs/js-ipfs#feat/gossipsub-as-default-pubsub",
"is-running": "^2.1.0",
"lint-staged": "^9.2.5",
"proxyquire": "^2.1.3",
Expand Down
2 changes: 1 addition & 1 deletion src/endpoint/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const routeConfig = {
}
}

let nodes = {}
const nodes = {}

/**
* @namespace EndpointServerRoutes
Expand Down
4 changes: 2 additions & 2 deletions src/ipfsd-daemon.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const NON_DISPOSABLE_GRACE_PERIOD = 10500 * 3

function translateError (err) {
// get the actual error message to be the err.message
let message = err.message
const message = err.message
err.message = err.stderr
err.stderr = message

Expand Down Expand Up @@ -240,7 +240,7 @@ class Daemon {

let output = ''

return new Promise(async (resolve, reject) => {
return new Promise(async (resolve, reject) => { // eslint-disable-line no-async-promise-executor
this.subprocess = run(this, args, {
env: this.env,
stderr: (data) => {
Expand Down
6 changes: 5 additions & 1 deletion src/ipfsd-in-proc.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,15 @@ class InProc extends EventEmitter {
pubsub: false,
sharding: false
})
this.opts.pubsub = defaultsDeep({}, opts.pubsub, {
enabled: false
})

this.opts.args.forEach((arg) => {
if (arg === '--enable-pubsub-experiment') {
this.opts.EXPERIMENTAL.pubsub = true
} else if (arg === '--enable-pubsub') {
this.opts.pubsub = true
this.opts.pubsub.enabled = true
} else if (arg === '--enable-sharding-experiment') {
this.opts.EXPERIMENTAL.sharding = true
} else if (arg === '--enable-namesys-pubsub') {
Expand All @@ -68,6 +71,7 @@ class InProc extends EventEmitter {
offline: this.opts.offline,
EXPERIMENTAL: this.opts.EXPERIMENTAL,
libp2p: this.opts.libp2p,
pubsub: this.opts.pubsub,
config: this.opts.config,
relay: this.opts.relay
})
Expand Down
4 changes: 2 additions & 2 deletions test/npm-install.node.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ types.forEach((type) => {
})

it('has the correct path when installed with npm3', async () => {
let execPath = type === 'js'
const execPath = type === 'js'
? 'ipfsd-ctl-test/node_modules/ipfs/src/cli'
: 'ipfsd-ctl-test/node_modules/go-ipfs-dep/go-ipfs'

let npm3Path = path.join(tmp, execPath)
const npm3Path = path.join(tmp, execPath)

await fs.mkdirp(npm3Path)
fs.writeFileSync(path.join(npm3Path, appName))
Expand Down
4 changes: 2 additions & 2 deletions test/spawn-options.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ describe('Spawn options', function () {
this.timeout(20 * 1000)

const options = {
args: ['--enable-pubsub-experiment'],
args: [fOpts.type !== 'go' ? '--enable-pubsub' : '--enable-pubsub-experiment'],
initOptions: { bits: fOpts.bits, profile: 'test' }
}

Expand All @@ -325,7 +325,7 @@ describe('Spawn options', function () {
const topic = `test-topic-${hat()}`
const data = Buffer.from('hey there')

return new Promise(async (resolve, reject) => {
return new Promise(async (resolve, reject) => { // eslint-disable-line no-async-promise-executor
const handler = (msg) => {
try {
expect(msg.data).to.eql(data)
Expand Down