-
Notifications
You must be signed in to change notification settings - Fork 187
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
Innernet writes /etc/hosts when only the order of mappings in a section has changed, not the mappings themselves #233
Comments
Hi @kevenwyld, sorting the lines added to hosts file would be a good idea! I'm looking at the code, it should be a matter of changing Line 84 in e98c065
However, even when the hostname list is sorted, it seems that there is currently no detection of `hostname file is already the same as we want to write", so we'd need to add that too (I think we should). Do you want to try contributing such improvement? |
Thanks @strohel . I am up for trying to trying to contribute however this would be my first experience with rust. I will see what I can come up with but it may take me a few days. |
Hey, just wanted to say that I'm still working on this, sorry for the silence. @mcginty helped me out a bit getting up to speed. |
Hey @kevenwyld ! Since this seems inactive and the change is pretty simple, I decided to open a PR. #259 |
Hey thanks @evaporei! Life happened and I didn't have time to get it done. |
Currently /etc/hosts is written very frequently, nearly every minute, because innernet writes the contents of each section as it is received. Apparently those checkins, or whatever is triggering HostsBuilder to run, is receiving the list of hosts in the order they respond which is not always the same. This order is carried through to the order mappings appear in the hosts file.
Would it be possible to sort the list of hosts in each section before checking to see if /etc/hosts requires updating? This would, I think, change the behavior so that updating /etc/hosts only happens when there is actually an ip/hostname update required and make it much less frequent.
Thanks!
The text was updated successfully, but these errors were encountered: