subtract task eta from queue wait so countdowns aren't counted#33
Conversation
Current Aviator status
This PR was merged using Aviator (commit 573b73f).
See the real-time status of this PR on the
Aviator webapp.
Use the Aviator Chrome Extension
to see the status of your PR within GitHub.
|
There was a problem hiding this comment.
Code Review
This pull request updates queue wait time and oldest queued task age calculations to account for scheduled tasks (ETA/countdown), measuring wait times from when a task is actually due to run rather than when it was sent. Feedback highlights a critical issue where parsing timezone-naive ISO-8601 strings treats them as local system time instead of UTC, and a fix is suggested to explicitly apply UTC timezone info.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
|
||
|
|
||
| def _parse_expires(value: Any) -> float | None: | ||
| def _parse_timestamp(value: Any) -> float | None: |
There was a problem hiding this comment.
When parsing a timezone-naive ISO-8601 string (which Celery events typically use for UTC timestamps), datetime.datetime.fromisoformat(value).timestamp() treats the naive datetime as being in the local system timezone of the machine running celerymon. If the system timezone is not UTC, this will result in incorrect timestamps for eta_ts and expires_ts, leading to incorrect queue wait times and oldest queued age calculations.
To fix this, we should explicitly treat timezone-naive datetimes as UTC:
def _parse_timestamp(value: Any) -> float | None:
if value is None:
return None
if isinstance(value, (int, float)):
return float(value)
if isinstance(value, str):
try:
dt = datetime.datetime.fromisoformat(value)
if dt.tzinfo is None:
dt = dt.replace(tzinfo=datetime.timezone.utc)
return dt.timestamp()
except ValueError:
return None
return None23f6ac4 to
a4c79b4
Compare
queue wait was measured from task-sent, so countdown/ETA dispatch counted the intentional delay as wait. measure from when the task is due (max of sent, eta) instead. same fix for the oldest-queued-age gauge.