: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(shopify): classify exhausted rate-limit retries as retryable noise (#76421)
Tom Owers9745715e3fe6
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/shopify/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/shopify/source.pyindex 936796ce45cd..3b7a25e9a2d8 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/shopify/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/shopify/source.py@@ -87,6 +87,19 @@ class ShopifySource(ResumableSource[ShopifySourceConfig, ShopifyResumeConfig]):SHOPIFY_GRAPHQL_UNAUTHORIZED_ERROR_MATCH: SHOPIFY_GRAPHQL_UNAUTHORIZED_ERROR_MESSAGE,}+ def get_retryable_errors(self) -> set[str]:+ # These are the messages `ShopifyRetryableError` carries once `_make_paginated_shopify_+ # request`'s `execute` exhausts its own tenacity retries (5 attempts, exponential backoff+ # honoring Shopify's throttle refill time — retried alongside transient `ConnectionError`/+ # `Timeout`) and re-raises. Surviving all 5 attempts means the rate limit or upstream blip+ # is still live, but Temporal retries the whole activity and it's self-recovering, so keep+ # it out of error tracking as noise.+ return {+ "Shopify: rate limit exceeded",+ "Shopify: internal error",+ "Shopify: connection broken while reading response",+ }+@propertydef get_source_config(self) -> SourceConfig:return SourceConfig(diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/shopify/tests/test_non_retryable_errors.py b/products/warehouse_sources/backend/temporal/data_imports/sources/shopify/tests/test_non_retryable_errors.pyindex 5110d575d9f9..df2015f361b9 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/shopify/tests/test_non_retryable_errors.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/shopify/tests/test_non_retryable_errors.py@@ -83,3 +83,22 @@ def test_transient_http_errors_stay_retryable(status_code, reason):assert not any(pattern in error_message for pattern in patterns), (f"transient error '{error_message}' should remain retryable")+++ "error_message",+ [+ "Shopify: rate limit exceeded...",+ "Shopify: internal error from request 500 Internal Server Error",+ 'Shopify: internal errors in payload [{"message": "internal error", "extensions": {"code": "internal_server_error"}}]',+ "Shopify: connection broken while reading response: Connection broken: IncompleteRead(0 bytes read)",+ ],+)+def test_exhausted_internal_retries_are_classified_as_retryable(error_message):+ # These messages only reach `_handle_import_error` after `_make_paginated_shopify_request`'s+ # own tenacity retries (5 attempts) are exhausted, so they should be logged as a warning+ # and left for Temporal's activity retry rather than reported to error tracking as noise.+ patterns = ShopifySource().get_retryable_errors()+ assert any(pattern in error_message for pattern in patterns), (+ f"exhausted-retry error '{error_message}' should be classified as retryable"+ )