From 257abee3e19a4aa7eb7f73f329d8ba76da28ef28 Mon Sep 17 00:00:00 2001 From: Dan Fuller Date: Fri, 10 Oct 2025 14:53:29 -0700 Subject: [PATCH] fix(crons): Fix race where we can create duplicate `DataSource` rows Since we ingest cron checkins at a high rate, we can end up in a race condition where we create duplicate `DataSource` rows. There's no unique constraint here currently, so we end up with duplicate rows. We'll need to clean up the duplicates as well. --- src/sentry/monitors/consumers/monitor_consumer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sentry/monitors/consumers/monitor_consumer.py b/src/sentry/monitors/consumers/monitor_consumer.py index edbab823c0fe88..a2eb35fd19a72b 100644 --- a/src/sentry/monitors/consumers/monitor_consumer.py +++ b/src/sentry/monitors/consumers/monitor_consumer.py @@ -176,8 +176,8 @@ def _ensure_monitor_with_config( "is_upserting": True, }, ) - ensure_cron_detector(monitor) if created: + ensure_cron_detector(monitor) signal_monitor_created(project, None, True, monitor, None) # Update existing monitor