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(