Skip to content

subtract task eta from queue wait so countdowns aren't counted#33

Merged
aviator-app[bot] merged 1 commit into
mainfrom
subtract-eta-from-queue-wait
Jun 17, 2026
Merged

subtract task eta from queue wait so countdowns aren't counted#33
aviator-app[bot] merged 1 commit into
mainfrom
subtract-eta-from-queue-wait

Conversation

@tulioz

@tulioz tulioz commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

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.

@aviator-app

aviator-app Bot commented Jun 9, 2026

Copy link
Copy Markdown

Current Aviator status

Aviator will automatically update this comment as the status of the PR changes.
Comment /aviator refresh to force Aviator to re-examine your PR (or learn about other /aviator commands).

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.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

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 None

@tulioz tulioz force-pushed the subtract-eta-from-queue-wait branch from 23f6ac4 to a4c79b4 Compare June 17, 2026 18:45
@aviator-app aviator-app Bot merged commit 573b73f into main Jun 17, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants