:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(close): retry organization-fetch 500s instead of tracking them (#108599)
Tom Owers196ccf7efeae
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/close/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/close/source.pyindex 1ef94314106c..6eee3a04bd38 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/close/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/close/source.py@@ -8,6 +8,7 @@ from products.warehouse_sources.backend.facade.source_config import (SourceFieldInputConfigType,)from products.warehouse_sources.backend.temporal.data_imports.sources.close.close import (+ CLOSE_BASE_URL,CloseResumeConfig,close_source,validate_credentials as validate_close_credentials,@@ -54,7 +55,16 @@ class CloseSource(ResumableSource[CloseSourceConfig, CloseResumeConfig]):# regardless of the underlying cause (refused connection, read timeout, dropped socket), so# match that stable prefix rather than the per-request URL or nested error detail. Temporal# then retries the whole activity, so the failure is transient and self-recovering.- return {"Max retries exceeded with url"}+ return {+ "Max retries exceeded with url",+ # `close_organizations_source` calls `/me/` and `/organization/{id}/` directly with+ # `raise_for_status()` rather than through the shared REST engine, so a persistent 5xx+ # there isn't wrapped as `RESTClientRetryableError`. `DEFAULT_RETRY` already retried the+ # request in-process before this reaches us, so a Close-side 500 here is a transient+ # upstream blip, not a bug. Match the stable prefix (status + reason + endpoint), not+ # the organization id in the URL.+ f"500 Server Error: Internal Server Error for url: {CLOSE_BASE_URL}/organization/",+ }def get_canonical_descriptions(self) -> CanonicalDescriptions:from products.warehouse_sources.backend.temporal.data_imports.sources.close.canonical_descriptions import (diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/close/tests/test_close_source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/close/tests/test_close_source.pyindex 4b7fb774bb30..feb7b0b86b4d 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/close/tests/test_close_source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/close/tests/test_close_source.py@@ -84,3 +84,10 @@ class TestCloseSource:"'api.close.com', port=443): Read timed out. (read timeout=60)\"))")assert any(pattern in error_msg for pattern in self.source.get_retryable_errors())++ def test_retryable_errors_match_organization_fetch_server_error(self) -> None:+ error_msg = (+ "500 Server Error: Internal Server Error for url: "+ "https://api.close.com/api/v1/organization/orga_test1234567890/"+ )+ assert any(pattern in error_msg for pattern in self.source.get_retryable_errors())