Skip to content

Commit

Permalink
fix: improve CI stability (#900)
Browse files Browse the repository at this point in the history
  • Loading branch information
suxb201 authored Dec 11, 2024
1 parent 71820fd commit 770fe60
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions tests/helpers/utils/network.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
import random
import socket
import threading


def is_port_available(port: int) -> bool:
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
try:
s.bind(('localhost', port))
s.close()
s.bind(('0.0.0.0', port))
return True
except OSError:
return False


MIN_PORT = 20000
MIN_PORT = 1000
MAX_PORT = 40000

port_cursor = random.choice(range(MIN_PORT, MAX_PORT, 1000))
port_cursor = MIN_PORT

g_lock = threading.Lock()

Expand Down

0 comments on commit 770fe60

Please sign in to comment.