-
Notifications
You must be signed in to change notification settings - Fork 297
Can't connect to individual nodes with many instances #84
Comments
Progress so far in figuring out why: Tried inlining config, if there was any troubles there. Nothing. Made a "sample" commit for showing what the problem is: https://github.com/VictorBjelkholm/node-ipfs-api/commit/d2418e9eef36b591de17d3bcea02b6eb0e28d576 Try it with the test code above |
I would suggest changing the api to sth like this to avoid these issues in the future: // index.js
function API(url) {
this.config = makeConfig(url)
this.request = requestApi.bind(null, this.config)
}
API.prototype.id = function () {
this.request('id')
} |
@victorbjelkholm could you make a PR with a failing test for this please, that would be easier to ensure any fix works as advertised |
@victorbjelkholm created a test and something I thought would fix it, but the test is still failing, take a look: dignifiedquire@c1f1833 |
@victorbjelkholm I'm still trying to nail down and reproduce this error, printing the config obj from inside the request-api always gives me the host + port of the disposable daemon (which changes at each run).
It would be very odd if it were always using the default config, because we have been using disposable daemons (in random ports) for a long time. Could you try it again, with the |
@diasdavid the issue is notthat it always uses the default config, the issue is that it shares the config between multiple instances because the config object is in a module. So if you instantiate the first api and then a second one with a different config you end up with the first one using the config of the second because it got overriden. |
@diasdavid just tried the |
sweet! Glad to know that :D thank you for finding that bug! |
So, I'm trying to have a couple of IPFS machines to mirror some content. So I've setup two boxes to test, and assign them to different variables and I expected that I would be able to call them separately but there is apparently some sharing in between them...
Example:
The last one is the one being used.
The text was updated successfully, but these errors were encountered: