: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
chore(alerts): shorten probe timeout test durations (#111947)
Paul D'Ambrac504eda5190c
diff --git a/products/alerts_platform/backend/temporal/workflows.py b/products/alerts_platform/backend/temporal/workflows.pyindex 58bf26107d97..0010dda0b5e7 100644--- a/products/alerts_platform/backend/temporal/workflows.py+++ b/products/alerts_platform/backend/temporal/workflows.py@@ -51,6 +51,8 @@ with workflow.unsafe.imports_passed_through():POSTGRES_PROBE_FAILURE = "AlertsPlatformPostgresProbeFailure"+POSTGRES_PROBE_START_TO_CLOSE_TIMEOUT = dt.timedelta(seconds=10)+POSTGRES_PROBE_SCHEDULE_TO_CLOSE_TIMEOUT = dt.timedelta(seconds=30)# A tick stops starting pages once this much of its minute is spent. The schedule's 50-second# execution timeout is the backstop, and it spans continued runs.@@ -204,8 +206,8 @@ class AlertsPlatformEvaluateWorkflow(PostHogWorkflow):await workflow.execute_activity(alerts_platform_probe_postgres_activity,task_queue=settings.ALERTS_PLATFORM_EVALUATION_TASK_QUEUE,- start_to_close_timeout=dt.timedelta(seconds=10),- schedule_to_close_timeout=dt.timedelta(seconds=30),+ start_to_close_timeout=POSTGRES_PROBE_START_TO_CLOSE_TIMEOUT,+ schedule_to_close_timeout=POSTGRES_PROBE_SCHEDULE_TO_CLOSE_TIMEOUT,retry_policy=RetryPolicy(maximum_attempts=1),)except ActivityError as error:diff --git a/products/alerts_platform/backend/tests/test_temporal_workflows.py b/products/alerts_platform/backend/tests/test_temporal_workflows.pyindex 9cbfbe2b63fd..e56856f5d0cd 100644--- a/products/alerts_platform/backend/tests/test_temporal_workflows.py+++ b/products/alerts_platform/backend/tests/test_temporal_workflows.py@@ -57,7 +57,10 @@ from products.alerts_platform.backend.facade.temporal import ()from products.alerts_platform.backend.logic import demandfrom products.alerts_platform.backend.models import PlatformAlert, PlatformAlertConfiguration-from products.alerts_platform.backend.temporal import postgres+from products.alerts_platform.backend.temporal import (+ postgres,+ workflows as alert_workflows,+)from products.alerts_platform.backend.temporal.workflows import (THREAD_BUSY,AlertsPlatformEvaluateWorkflow,@@ -368,9 +371,14 @@ async def test_delivery_waits_out_a_held_thread_and_fails_when_it_never_frees(@pytest.mark.parametrize("timeout_type", [TimeoutType.START_TO_CLOSE, TimeoutType.SCHEDULE_TO_CLOSE])async def test_probe_timeout_still_starts_independent_delivery(- environment: WorkflowEnvironment, caplog: pytest.LogCaptureFixture, timeout_type: TimeoutType+ environment: WorkflowEnvironment,+ caplog: pytest.LogCaptureFixture,+ monkeypatch: pytest.MonkeyPatch,+ timeout_type: TimeoutType,) -> None:caplog.set_level(logging.WARNING, logger="temporalio.workflow")+ monkeypatch.setattr(alert_workflows, "POSTGRES_PROBE_START_TO_CLOSE_TIMEOUT", dt.timedelta(seconds=5))+ monkeypatch.setattr(alert_workflows, "POSTGRES_PROBE_SCHEDULE_TO_CLOSE_TIMEOUT", dt.timedelta(seconds=15))activity_started = asyncio.Event()release_activity = asyncio.Event()@@ -401,7 +409,7 @@ async def test_probe_timeout_still_starts_independent_delivery(passif timeout_type == TimeoutType.SCHEDULE_TO_CLOSE:# Separate the close deadlines instead of racing schedule-to-start at the same deadline.- await environment.sleep(25)+ await environment.sleep(12)async with Worker(client,task_queue=settings.ALERTS_PLATFORM_EVALUATION_TASK_QUEUE,