Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 2 additions & 16 deletions src/sentry/uptime/consumers/results_consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,16 +353,9 @@ def handle_active_result(
**result,
},
)
# TODO(epurkhiser): Dual until we're only reading the uptime_status
# from the uptime_subscription.
now = django_timezone.now()
project_subscription.update(
uptime_status=UptimeStatus.FAILED,
uptime_status_update_date=now,
)
project_subscription.uptime_subscription.update(
uptime_status=UptimeStatus.FAILED,
uptime_status_update_date=now,
uptime_status_update_date=django_timezone.now(),
)
elif uptime_status == UptimeStatus.FAILED and result_status == CHECKSTATUS_SUCCESS:
if not has_reached_status_threshold(project_subscription, result_status, metric_tags):
Expand All @@ -385,16 +378,9 @@ def handle_active_result(
**result,
},
)
# TODO(epurkhiser): Dual until we're only reading the uptime_status
# from the uptime_subscription.
now = django_timezone.now()
project_subscription.update(
uptime_status=UptimeStatus.OK,
uptime_status_update_date=now,
)
project_subscription.uptime_subscription.update(
uptime_status=UptimeStatus.OK,
uptime_status_update_date=now,
uptime_status_update_date=django_timezone.now(),
)


Expand Down
17 changes: 5 additions & 12 deletions src/sentry/uptime/subscriptions/subscriptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ def create_project_uptime_subscription(
name=name,
owner_user_id=owner_user_id,
owner_team_id=owner_team_id,
uptime_status=uptime_status,
)
detector = create_detector_from_project_subscription(uptime_monitor)

Expand Down Expand Up @@ -354,17 +353,11 @@ def disable_uptime_detector(detector: Detector):
# Resolve the issue so that we don't see it in the ui anymore
resolve_uptime_issue(uptime_monitor)

uptime_monitor.update(
status=ObjectStatus.DISABLED,
# We set the status back to ok here so that if we re-enable we'll start
# from a good state
uptime_status=UptimeStatus.OK,
)
uptime_subscription.update(
# We set the status back to ok here so that if we re-enable we'll start
# from a good state
uptime_status=UptimeStatus.OK
)
# We set the status back to ok here so that if we re-enable we'll start
# from a good state
uptime_subscription.update(uptime_status=UptimeStatus.OK)

uptime_monitor.update(status=ObjectStatus.DISABLED)
detector.update(enabled=False)

quotas.backend.remove_seat(DataCategory.UPTIME, uptime_monitor)
Expand Down
Loading