@@ -77,7 +77,7 @@ def run(self) -> Workflow:
7777
7878 return workflow
7979
80- def _create_detector_lookups (self ) -> list [Detector | None ]:
80+ def _create_detector_lookups (self ) -> list [Detector ]:
8181 if self .rule .source == RuleSource .CRON_MONITOR :
8282 # Find the cron detector that was created before the rule
8383 monitor_slug = None
@@ -87,7 +87,7 @@ def _create_detector_lookups(self) -> list[Detector | None]:
8787 break
8888
8989 if not monitor_slug :
90- return [None ]
90+ return []
9191
9292 try :
9393 with in_test_hide_transaction_boundary ():
@@ -105,7 +105,7 @@ def _create_detector_lookups(self) -> list[Detector | None]:
105105 except (Monitor .DoesNotExist , Detector .DoesNotExist ):
106106 pass
107107
108- return [None ]
108+ return []
109109
110110 if self .is_dry_run :
111111 error_detector = Detector .objects .filter (
@@ -139,9 +139,25 @@ def _create_detector_lookups(self) -> list[Detector | None]:
139139
140140 def _connect_default_detectors (self , workflow : Workflow ) -> None :
141141 default_detectors = self ._create_detector_lookups ()
142- for detector in default_detectors :
143- if detector :
144- DetectorWorkflow .objects .get_or_create (detector = detector , workflow = workflow )
142+
143+ # do not add references to both issue stream and error group types
144+ # it seems like other types might be relying on this as well,
145+ # so this just says not to link the error groups.
146+ # TODO - provide helpers to more easily create these classes
147+ # and references in code, so we can remove the reliance on this code
148+ references_to_create = [
149+ DetectorWorkflow (
150+ detector = detector ,
151+ workflow = workflow ,
152+ )
153+ for detector in default_detectors
154+ if detector .type != ErrorGroupType .slug
155+ ]
156+
157+ DetectorWorkflow .objects .bulk_create (
158+ references_to_create ,
159+ ignore_conflicts = True ,
160+ )
145161
146162 def _bulk_create_data_conditions (
147163 self ,
0 commit comments