Skip to content

Commit

Permalink
feat: pubsub flag defaults (#363)
Browse files Browse the repository at this point in the history
This PR points js-ipfs dependency to a PR in js-ipfs and because of that should be used with care!! 
A following PR should fix this shortly.

BREAKING CHANGE: removes the experimental flag of pubsub and makes it enable by default
  • Loading branch information
vasco-santos authored and hugomrdias committed Sep 2, 2019
1 parent 9ba61d7 commit 6958239
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 9 deletions.
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

0 comments on commit 6958239

Please sign in to comment.