Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: improve CI stability #900

Merged
merged 1 commit into from
Dec 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading