|
17 | 17 | from sentry.models.activity import Activity |
18 | 18 | from sentry.models.environment import Environment |
19 | 19 | from sentry.models.eventattachment import EventAttachment |
20 | | -from sentry.models.group import Group, GroupStatus |
| 20 | +from sentry.models.group import Group |
21 | 21 | from sentry.models.groupenvironment import GroupEnvironment |
22 | 22 | from sentry.models.grouphash import GroupHash |
23 | | -from sentry.models.groupopenperiod import GroupOpenPeriod |
24 | 23 | from sentry.models.grouprelease import GroupRelease |
25 | 24 | from sentry.models.project import Project |
26 | 25 | from sentry.models.release import Release |
@@ -203,7 +202,6 @@ def migrate_events( |
203 | 202 | destination = Group.objects.get(id=destination_id) |
204 | 203 | destination.update(**get_group_backfill_attributes(caches, destination, events)) |
205 | 204 |
|
206 | | - update_open_periods(source, destination) |
207 | 205 | logger.info("migrate_events.migrate", extra={**extra, "destination_id": destination_id}) |
208 | 206 |
|
209 | 207 | if isinstance(args, InitialUnmergeArgs) or opt_eventstream_state is None: |
@@ -249,35 +247,6 @@ def migrate_events( |
249 | 247 | return (destination.id, eventstream_state) |
250 | 248 |
|
251 | 249 |
|
252 | | -def update_open_periods(source: Group, destination: Group) -> None: |
253 | | - # For groups that are not resolved, the open period created on group creation should have the necessary information |
254 | | - if destination.status != GroupStatus.RESOLVED: |
255 | | - return |
256 | | - |
257 | | - try: |
258 | | - dest_open_period = GroupOpenPeriod.objects.get(group=destination) |
259 | | - except GroupOpenPeriod.DoesNotExist: |
260 | | - logger.exception("No open period found for group", extra={"group_id": destination.id}) |
261 | | - |
262 | | - source_open_period = ( |
263 | | - GroupOpenPeriod.objects.filter(group=source).order_by("-date_started").first() |
264 | | - ) |
265 | | - if not source_open_period: |
266 | | - logger.error("No open period found for group", extra={"group_id": destination.id}) |
267 | | - return |
268 | | - |
269 | | - if source_open_period.date_ended is None: |
270 | | - return |
271 | | - |
272 | | - # If the destination group is resolved, set the open period fields to match the source's open period. |
273 | | - dest_open_period.update( |
274 | | - date_started=source_open_period.date_started, |
275 | | - date_ended=source_open_period.date_ended, |
276 | | - resolution_activity=source_open_period.resolution_activity, |
277 | | - user_id=source_open_period.user_id, |
278 | | - ) |
279 | | - |
280 | | - |
281 | 250 | def truncate_denormalizations(project: Project, group: Group) -> None: |
282 | 251 | GroupRelease.objects.filter(group_id=group.id).delete() |
283 | 252 |
|
|
0 commit comments