Update WebHostLib/customserver.py

Co-authored-by: black-sliver <59490463+black-sliver@users.noreply.github.com>
This commit is contained in:
Uriel
2026-03-09 07:00:44 -03:00
committed by GitHub
parent 1748048b44
commit aff006a85f

View File

@@ -270,7 +270,7 @@ def get_active_net_connections() -> typing.Iterable[int]:
def get_used_ports():
last_used_ports: tuple[frozenset[int], float] = getattr(get_used_ports, "last", None)
t_hash = time.time() // 900
t_hash = round(time.time() / 90) # cache for 90 seconds
if last_used_ports is None or last_used_ports[1] != t_hash:
last_used_ports = (frozenset(get_active_net_connections()), t_hash)
setattr(get_used_ports, "last", last_used_ports)