http-party/node-portfinder

Replace sequential scan with random search

BarthesSimpson opened this issue · 3 comments

Instead of scanning from the base port to the highest port, a randomized search would be more robust. Currently, if I am launching several servers in quick succession, there can be port collisions because one server may not have finished binding to the port discovered by portfinder before the next call to getPort, which then considers the same port to still be unbound.

Currently, if I am launching several servers in quick succession, there can be port collisions because one server may not have finished binding to the port discovered by portfinder before the next call to getPort, which then considers the same port to still be unbound.

Yes, this an issue I am aware of. Randomizing the port scanning is an interesting idea -- open to a PR on this, thanks!

(Sorry for the triplicate PR - my GitHub chops are a bit rusty)

fixed by #82