Find An Unused Random Local Port And Announce It On Redis
The article provides a detailed explanation of a Python script designed to find an unused local port and store it in Redis. It demonstrates the implementation using redis-py and the Python Redis library, making it easy for developers to understand and utilize this method for their projects.
issues were found when launching apps on fixed ports.
maybe you should create this entry inside your lazero
package? no need for uploading to pypi, just keep it under pyjom
and leave a local install script there.
make sure all related services are going to launch after the redis_service.service
target. on macos or windows this may vary.
allocate multiple unused ports at once or they may overlap.
abandon ports found on redis.
python to get unused port:
1 | def getUnusedLocalhostPort(): |
install redis-py:
1 | pip install redis |
python send port to redis:
1 | import redis |