Skip to content

Commit

Permalink
fix(monitors): Correct date_added offset
Browse files Browse the repository at this point in the history
I believe this was missed in #45311
  • Loading branch information
evanpurkhiser committed Mar 14, 2023
1 parent 22f6893 commit ce07217
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/sentry/monitors/consumers/check_in.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ def process_message(message: Message[KafkaPayload]) -> None:

status = getattr(CheckInStatus, params["status"].upper())
duration = (
int(params["duration"] * 1000) if params.get("duration") is not None else None
# Duration is specified in seconds from the client, it is
# stored in the checkin model as miliseconds
int(params["duration"] * 1000)
if params.get("duration") is not None
else None
)

try:
Expand All @@ -63,7 +67,7 @@ def process_message(message: Message[KafkaPayload]) -> None:
# Note that the clock of this worker may be off from what Relay is reporting.
date_added = start_time
if duration is not None:
date_added -= datetime.timedelta(seconds=duration)
date_added -= datetime.timedelta(milliseconds=duration)

check_in = MonitorCheckIn.objects.create(
project_id=project_id,
Expand Down

0 comments on commit ce07217

Please sign in to comment.