Fix too many polygons issue

This commit is contained in:
Nitzan Pomerantz
2025-10-27 23:58:57 +02:00
parent a234e809bf
commit 3478426006
5 changed files with 42 additions and 12 deletions
+7
View File
@@ -57,6 +57,11 @@ class GovmapConfig:
default_deal_limit: int = field(
default_factory=lambda: int(os.getenv("GOVMAP_DEFAULT_DEAL_LIMIT", "100"))
)
# Performance optimization
max_polygons_to_query: int = field(
default_factory=lambda: int(os.getenv("GOVMAP_MAX_POLYGONS", "10"))
)
# User agent
user_agent: str = field(
@@ -90,6 +95,8 @@ class GovmapConfig:
raise ValueError("default_years_back must be positive")
if self.default_deal_limit <= 0:
raise ValueError("default_deal_limit must be positive")
if self.max_polygons_to_query <= 0:
raise ValueError("max_polygons_to_query must be positive")
if not self.base_url:
raise ValueError("base_url cannot be empty")
if not self.user_agent: