Skip to content

: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.

feat(bigquery): Retry up to 5 times on bad status codes (#74122)

Tomás Farías Santana5bd31d6ecac2
diff --git a/products/batch_exports/backend/temporal/destinations/bigquery_batch_export.py b/products/batch_exports/backend/temporal/destinations/bigquery_batch_export.py
index 50d8ba959a99..de9fc2346ae2 100644
--- a/products/batch_exports/backend/temporal/destinations/bigquery_batch_export.py
+++ b/products/batch_exports/backend/temporal/destinations/bigquery_batch_export.py
@@ -450,9 +450,11 @@ def _make_requests_session() -> "requests.Session":
from urllib3.util.retry import Retry
retry = Retry(
- total=5,
- connect=5, # Redundant to set this + total, but just being explicit
backoff_factor=1.0, # 0s, 2s, 4s, 6s, ...
+ connect=5, # Retry on connection errors
+ status=5, # Retry on statuses matching the ones below
+ status_forcelist=[429, 500, 502, 503],
+ allowed_methods=(*Retry.DEFAULT_ALLOWED_METHODS, "POST"),
)
session = requests.Session()