-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Change default config from JSON file to JS module #1324
Change default config from JSON file to JS module #1324
Conversation
Because the default config was a JSON file, it was treated as a singleton object. In some parts of the code, data got added to it, leading to race conditions when creating multiple nodes simultaneously. To make that harder to do accidentally, the default config is now a *function* that returns a unique configuration object on each call. Fixes ipfs#1316. License: MIT Signed-off-by: Rob Brackett <rob@robbrackett.com>
(CI failures are from in-progress |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thank you @Mr0grog :)
You are correct, the failing tests are not due to this PR, but the linting fail is. Can you update your PR to make sure it passes linting? |
License: MIT Signed-off-by: Rob Brackett <rob@robbrackett.com>
Ah! I hadn’t realized Jenkins was running different stuff than Travis and didn’t see those failures. Should be fixed now. I also noticed some of these:
Would you mind if I submitted a PR for adding a |
re: |
@Mr0grog also, added you to the JavaScript team on IPFS so that you can create branches on this repo, making collaboration easier. Right now, CI is failing because you need to rebase master onto this branch. |
I'm merging this PR as the failures are unrelated and fixed on master. Let's discuss the editorconfig in parallel and in the future, please open branchs on this repo directly. Thank you! |
Because the default node configuration was a JSON file, it was treated as a singleton object. In some parts of the code, data got added to it, leading to race conditions when creating multiple nodes simultaneously.
This is one approach to fixing it: to make creating a shared global object harder, the default config is now a function that returns a unique configuration object on each call. (The test is probably valuable whether or not we like this approach.)
Fixes #1316.