: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(customer-analytics): inherit backfill resource limits (#125842)
Arthur Moreira de Deus56fab8d4595b
diff --git a/products/customer_analytics/backend/logic/membership_backfill.py b/products/customer_analytics/backend/logic/membership_backfill.pyindex b69e12435e78..aeee6acdeadf 100644--- a/products/customer_analytics/backend/logic/membership_backfill.py+++ b/products/customer_analytics/backend/logic/membership_backfill.py@@ -43,11 +43,9 @@ WINDOW_SIZE = timedelta(days=1)HISTORICAL_WINDOW_SIZE = timedelta(days=90)QUERY_SETTINGS = {"max_execution_time": 120,- "max_memory_usage": 1_000_000_000,"max_bytes_to_read": 50 * 1024**4,"max_result_bytes": 8_000_000,"result_overflow_mode": "throw",- "max_threads": 30,"distributed_foreground_insert": 1,}diff --git a/products/customer_analytics/backend/test/test_membership_backfill.py b/products/customer_analytics/backend/test/test_membership_backfill.pyindex 0c4529c4a71a..fd37528e8067 100644--- a/products/customer_analytics/backend/test/test_membership_backfill.py+++ b/products/customer_analytics/backend/test/test_membership_backfill.py@@ -94,6 +94,22 @@ def test_batch_projection_is_scoped_and_bounded(catching_up: bool, native_json:assert ("FROM events_json" in sql) == native_json[email protected](("deadline", "expected_timeout"), [(None, 120), (25.0, 15), (310.0, 120)])+def test_query_inherits_shared_resources_and_respects_deadline(deadline: float | None, expected_timeout: int) -> None:+ service = MembershipBackfillService(deadline=deadline)+ with (+ patch(f"{MODULE}.sync_execute", return_value=[(1,)]) as execute,+ patch(f"{MODULE}.monotonic", return_value=10.0),+ ):+ assert service.query("SELECT 1", {}, team_id=17) == [(1,)]++ execute.assert_called_once()+ query_settings = cast(dict[str, int | str], execute.call_args.kwargs["settings"])+ assert "max_memory_usage" not in query_settings+ assert "max_threads" not in query_settings+ assert query_settings["max_execution_time"] == expected_timeout++@pytest.mark.parametrize("enabled", [False, True, None])def test_shared_gate_uses_organization_identity(enabled: bool | None) -> None:team = Team(id=7, organization_id="00000000-0000-4000-8000-000000000001")