ws-ephemeral icon indicating copy to clipboard operation
ws-ephemeral copied to clipboard

feat: Implement Port Manager for Handling Port Expiration and State Management

Open faviann opened this issue 1 year ago • 2 comments
trafficstars

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 .env file.
  • Integrated the PortManager into 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

faviann avatar Nov 10 '24 16:11 faviann

thank you for the pull request, I will have look at it this weekend.

dhruvinsh avatar Nov 12 '24 17:11 dhruvinsh

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

faviann avatar Nov 14 '24 15:11 faviann