Skip to content

Commit ada6942

Browse files
fix(crons): Floor seconds / microsecond on recorded dateClock (#91890)
We record this value for check-ins, this is supposed to be trimmed of it's seconds and microseconds, since we count clock ticks in minutes
1 parent e512ec7 commit ada6942

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/sentry/monitors/consumers/monitor_consumer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -826,7 +826,7 @@ def _process_checkin(item: CheckinItem, txn: Transaction | Span) -> None:
826826
#
827827
# XXX: They are NOT timezone aware date times, set the timezone
828828
# to UTC
829-
clock_time = item.ts.replace(tzinfo=UTC)
829+
clock_time = item.ts.replace(second=0, microsecond=0, tzinfo=UTC)
830830

831831
# Record the reported in_progress time when the check is in progress
832832
date_in_progress = start_time if status == CheckInStatus.IN_PROGRESS else None

tests/sentry/monitors/consumers/test_monitor_consumer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,7 @@ def test_check_in_date_clock(self):
357357
self.send_checkin(monitor.slug, ts=ts, item_ts=item_ts)
358358
checkin = MonitorCheckIn.objects.get(guid=self.guid)
359359
assert checkin.date_added == ts.replace(tzinfo=UTC)
360-
assert checkin.date_clock == item_ts.replace(tzinfo=UTC)
360+
assert checkin.date_clock == item_ts.replace(second=0, microsecond=0, tzinfo=UTC)
361361

362362
def test_check_in_date_in_progress(self):
363363
monitor = self._create_monitor(slug="my-monitor")

0 commit comments

Comments
 (0)