-
Notifications
You must be signed in to change notification settings - Fork 29
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
Only one HostsResolver per hosts file #28
Conversation
@dylang What do you think about this? |
Thanks for your quick attention this. This does not solve the memory issue, at least not in Jest. I'll try to dig deeper later, I can't right now. |
I think it doesn't solve the problem in this part of the code: this._promise = (async () => {
if (typeof this._hostsPath !== 'string') {
return;
}
await this._update();
if (this._error) {
return;
}
watchFile(this._hostsPath, {
persistent: false
}, (current, previous) => {
if (current.mtime > previous.mtime) {
this._update();
}
}).once('error', error => {
this._error = error;
this._hosts = {};
});
this._promise = null;
})(); Can What stops |
Simply pass |
Yep, will do this tomorrow. |
That prevents it, but once Also, unrelated, using fs.watch() is more efficient than fs.watchFile() |
Unfortunately there are no destructors in JS.
Thanks, didn't know that! But this doesn't fix the memory leak either, does it? |
239b361
to
1235367
Compare
Correct. This is why it might be better to export a method to start and stop the watcher. |
Fixes #25