Timeout grab camera 60 s e sorgenti admin 15 s (prima apertura GenTL lenta). Refs #106
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -182,7 +182,7 @@ def api_camera_sources():
|
||||
if parsed.scheme not in ("http", "https") or not parsed.netloc:
|
||||
return jsonify({"error": True, "detail": _("Indirizzo della camera non valido")}), 400
|
||||
try:
|
||||
resp = http_requests.get(f"{url.rstrip('/')}/camera/sources", timeout=5)
|
||||
resp = http_requests.get(f"{url.rstrip('/')}/camera/sources", timeout=15) # #106: era 5, la prima apertura GenTL supera 15 s
|
||||
except http_requests.RequestException as exc:
|
||||
return jsonify({
|
||||
"error": True,
|
||||
|
||||
@@ -17,6 +17,9 @@ from services.file_proxy import proxy_file
|
||||
|
||||
maker_bp = Blueprint("maker", __name__, url_prefix="/maker")
|
||||
|
||||
# #106: la prima apertura GenTL dopo l'avvio supera 15 s, il grab ha bisogno di piu margine
|
||||
CAMERA_GRAB_TIMEOUT_S = 60
|
||||
|
||||
|
||||
# ============================================================================
|
||||
# PAGINE (GET)
|
||||
@@ -608,7 +611,7 @@ def api_station_camera_grab(station_id: int):
|
||||
resp = http_requests.post(
|
||||
f"{camera_url.rstrip('/')}/camera/grab",
|
||||
json={"source": camera_source, "trigger": "continuo", "timeout_ms": 5000},
|
||||
timeout=15,
|
||||
timeout=CAMERA_GRAB_TIMEOUT_S, # #106: era 15, troppo corto alla prima apertura GenTL
|
||||
)
|
||||
except http_requests.RequestException as exc:
|
||||
return jsonify({
|
||||
|
||||
@@ -17,6 +17,9 @@ from services.file_proxy import proxy_file
|
||||
|
||||
measure_bp = Blueprint("measure", __name__)
|
||||
|
||||
# #106: la prima apertura GenTL dopo l'avvio supera 15 s, il grab ha bisogno di piu margine
|
||||
CAMERA_GRAB_TIMEOUT_S = 60
|
||||
|
||||
# Session key holding a station chosen at runtime, overriding Config.STATION_CODE.
|
||||
STATION_OVERRIDE_KEY = "station_override"
|
||||
|
||||
@@ -1117,7 +1120,7 @@ def api_vision_grab():
|
||||
resp = http_requests.post(
|
||||
f"{camera_url.rstrip('/')}/camera/grab",
|
||||
json={"source": camera_source, "trigger": "continuo", "timeout_ms": 5000},
|
||||
timeout=15,
|
||||
timeout=CAMERA_GRAB_TIMEOUT_S, # #106: era 15, troppo corto alla prima apertura GenTL
|
||||
)
|
||||
except http_requests.RequestException as exc:
|
||||
return jsonify({
|
||||
|
||||
@@ -278,7 +278,7 @@ def test_camera_sources_proxy_keeps_only_the_three_fields(logged_in_client, mock
|
||||
"name": "camera:folder", "label": "Cartella", "kind": "folder"}
|
||||
assert len(resp.get_json()["sources"]) == 2
|
||||
assert get.call_args.args[0] == "http://acq:8765/camera/sources"
|
||||
assert get.call_args.kwargs["timeout"] == 5
|
||||
assert get.call_args.kwargs["timeout"] == 15 # #106
|
||||
|
||||
|
||||
@pytest.mark.parametrize("url", ["ftp://x", "", "http://", "acq:8765"])
|
||||
|
||||
@@ -68,7 +68,7 @@ def test_grab_passes_png_through(logged_in_client, mock_api_client, monkeypatch)
|
||||
assert kwargs["json"] == {
|
||||
"source": "camera:folder", "trigger": "continuo", "timeout_ms": 5000,
|
||||
}
|
||||
assert kwargs["timeout"] == 15
|
||||
assert kwargs["timeout"] == 60 # #106
|
||||
|
||||
|
||||
def test_grab_service_503_is_502(logged_in_client, mock_api_client, monkeypatch):
|
||||
|
||||
Reference in New Issue
Block a user