devlinker 1.2.7__tar.gz → 1.2.8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {devlinker-1.2.7 → devlinker-1.2.8}/PKG-INFO +1 -1
- {devlinker-1.2.7 → devlinker-1.2.8}/devlinker/detector.py +42 -7
- {devlinker-1.2.7 → devlinker-1.2.8}/devlinker.egg-info/PKG-INFO +1 -1
- {devlinker-1.2.7 → devlinker-1.2.8}/pyproject.toml +1 -1
- {devlinker-1.2.7 → devlinker-1.2.8}/README.md +0 -0
- {devlinker-1.2.7 → devlinker-1.2.8}/devlinker/__init__.py +0 -0
- {devlinker-1.2.7 → devlinker-1.2.8}/devlinker/main.py +0 -0
- {devlinker-1.2.7 → devlinker-1.2.8}/devlinker/proxy.py +0 -0
- {devlinker-1.2.7 → devlinker-1.2.8}/devlinker/runner.py +0 -0
- {devlinker-1.2.7 → devlinker-1.2.8}/devlinker/tunnel.py +0 -0
- {devlinker-1.2.7 → devlinker-1.2.8}/devlinker.egg-info/SOURCES.txt +0 -0
- {devlinker-1.2.7 → devlinker-1.2.8}/devlinker.egg-info/dependency_links.txt +0 -0
- {devlinker-1.2.7 → devlinker-1.2.8}/devlinker.egg-info/entry_points.txt +0 -0
- {devlinker-1.2.7 → devlinker-1.2.8}/devlinker.egg-info/requires.txt +0 -0
- {devlinker-1.2.7 → devlinker-1.2.8}/devlinker.egg-info/top_level.txt +0 -0
- {devlinker-1.2.7 → devlinker-1.2.8}/setup.cfg +0 -0
- {devlinker-1.2.7 → devlinker-1.2.8}/setup.py +0 -0
|
@@ -6,15 +6,50 @@ from typing import Iterable, Optional, Tuple
|
|
|
6
6
|
import requests
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
""
|
|
9
|
+
DEFAULT_BACKEND_PROBE_PATHS = (
|
|
10
|
+
"/health",
|
|
11
|
+
"/api/health",
|
|
12
|
+
"/",
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def check_port(
|
|
17
|
+
port: int,
|
|
18
|
+
timeout: float = 1.0,
|
|
19
|
+
probe_paths: Iterable[str] = DEFAULT_BACKEND_PROBE_PATHS,
|
|
20
|
+
) -> bool:
|
|
21
|
+
"""Return True when an HTTP service is reachable on localhost:port.
|
|
22
|
+
|
|
23
|
+
Probe order is health-first (for API-style backends), then root fallback.
|
|
24
|
+
"""
|
|
25
|
+
normalized_paths: list[str] = []
|
|
26
|
+
for path in probe_paths:
|
|
27
|
+
cleaned = path.strip()
|
|
28
|
+
if not cleaned:
|
|
29
|
+
continue
|
|
30
|
+
if not cleaned.startswith("/"):
|
|
31
|
+
cleaned = f"/{cleaned}"
|
|
32
|
+
normalized_paths.append(cleaned)
|
|
33
|
+
|
|
34
|
+
if not normalized_paths:
|
|
35
|
+
normalized_paths = ["/"]
|
|
36
|
+
|
|
11
37
|
for host in ("localhost", "127.0.0.1"):
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
38
|
+
for path in normalized_paths:
|
|
39
|
+
try:
|
|
40
|
+
response = requests.get(f"http://{host}:{port}{path}", timeout=timeout)
|
|
41
|
+
except requests.RequestException:
|
|
42
|
+
continue
|
|
43
|
+
|
|
44
|
+
# Health endpoints must return 2xx/3xx to be considered ready.
|
|
45
|
+
if path in {"/health", "/api/health"}:
|
|
46
|
+
if 200 <= response.status_code < 400:
|
|
47
|
+
return True
|
|
48
|
+
continue
|
|
49
|
+
|
|
50
|
+
# Root fallback accepts non-error responses.
|
|
51
|
+
if 200 <= response.status_code < 400:
|
|
15
52
|
return True
|
|
16
|
-
except requests.RequestException:
|
|
17
|
-
pass
|
|
18
53
|
return False
|
|
19
54
|
|
|
20
55
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|