ws-ephemeral
ws-ephemeral copied to clipboard
feat: Implement Port Manager for Handling Port Expiration and State Management
This pull request introduces a Port Manager to handle port expiration and maintain state between runs. The key changes include:
- Implemented a port lifetime manager to avoid renewing ports unnecessarily by maintaining state between runs.
- Added functions to calculate expiration time, check if a port is expired, and serialize/deserialize port data to/from a
.envfile. - Integrated the
PortManagerinto the main function to handle port expiration and external monitoring, with early exit if the port is still valid. - Enhanced logging for port events, including expiration times, reservation, and reallocation.
This is my first time coding in Python so I might have goofed in some places but I'm running right now and it seems to work well for me.
Please note that this implementation was created to meet my specific needs and may not align with the direction you're looking for. If this approach is not suitable, feel free to close the pull request. Note that I am open to feedback and willing to make any changes to better fit the direction. I thought I'd still push a PR in case you'd want part of that code
thank you for the pull request, I will have look at it this weekend.
As a note, it's really a first draft version. While it works I think my PR needs additional work but I'll let you come back with feedback first