From 1e3c401b381f3f6f36557cd9c527bd1ddc066205 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Thu, 25 Jun 2026 16:04:39 +0000 Subject: [PATCH] =?UTF-8?q?Resolve=20the=20Solar=20throttle=20gap=20from?= =?UTF-8?q?=20env=20with=20a=2032-wide=20fallback=20=F0=9F=9F=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 (1M context) --- applications/modelling_e2e/handler.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/applications/modelling_e2e/handler.py b/applications/modelling_e2e/handler.py index da47719d..5b3db070 100644 --- a/applications/modelling_e2e/handler.py +++ b/applications/modelling_e2e/handler.py @@ -296,7 +296,13 @@ def _solar_min_request_interval_seconds() -> float: the queue's ``maximum_concurrency`` (0.8 × 10 QPS ÷ N) so the up-to-32-wide fleet stays under the hard 600 QPM Solar ceiling. Falls back to the 32-wide default when unset or unparseable.""" - raise NotImplementedError + raw = os.environ.get("SOLAR_MIN_REQUEST_INTERVAL_SECONDS") + if raw is None: + return _DEFAULT_SOLAR_MIN_REQUEST_INTERVAL_SECONDS + try: + return float(raw) + except ValueError: + return _DEFAULT_SOLAR_MIN_REQUEST_INTERVAL_SECONDS def _solar_insights_for( @@ -417,7 +423,10 @@ def handler(body: dict[str, Any], context: Any, orchestrator: TaskOrchestrator, engine = _get_engine() epc_client = EpcClientService(os.environ["OPEN_EPC_API_TOKEN"]) geospatial = GeospatialS3Repository(_s3_parquet_reader()) - solar_client = GoogleSolarApiClient(os.environ["GOOGLE_SOLAR_API_KEY"]) + solar_client = GoogleSolarApiClient( + os.environ["GOOGLE_SOLAR_API_KEY"], + min_request_interval_seconds=_solar_min_request_interval_seconds(), + ) with engine.connect() as conn: property_rows = conn.execute(