Resolve the Solar throttle gap from env with a 32-wide fallback 🟩

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Khalim Conn-Kowlessar 2026-06-25 16:04:39 +00:00
parent 85e203f366
commit 1e3c401b38

View file

@ -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(