Skip to content

DRU-484: Schedule usage polls with idle backoff - #488

Open
czpython wants to merge 2 commits into
mainfrom
codex/dru-484-usage-schedule
Open

DRU-484: Schedule usage polls with idle backoff#488
czpython wants to merge 2 commits into
mainfrom
codex/dru-484-usage-schedule

Conversation

@czpython

@czpython czpython commented Sep 8, 2026

Copy link
Copy Markdown
Owner

Usage snapshots stop updating when no Usage page is open. Add core.refresh_usage with a fixed five-minute schedule so connected subscriptions update without a browser.

UsageScrape.is_due() polls first-time subscriptions and subscriptions with a completed call after the last scrape. A completed call takes priority over an exhausted snapshot. Otherwise, an exhausted window waits for its earliest reset. A window reset makes one poll due.

Unchanged quota values increase the interval through 5, 10, 20, 40, and 60 minutes. One interval table sets the history limit and delay. The quota property compares the error tag, five-hour percentage, and weekly percentages in provider order. Only changed quota values restart the interval. Manual refresh retains its 60-second floor.

The task reloads each subscription before a poll. Session expiry and revocation during a tick do not break later polls. The schedule is a code constant, consistent with the current @task contract. No schema or frontend changes are required.

Validation

  • uv run ruff check backend and uv run ruff format --check backend passed.
  • uv run pytest backend/ passed: 1,744 tests.
  • The focused usage run passed: 55 tests across scheduling, provider polls, and usage routes.
  • Backend and frontend CI passed. The documentation preview passed. Frontend checks ran in CI for this revision.
  • Tests used mocked provider endpoints. No live provider or deployment checks ran.

Closes DRU-484.

@mintlify

mintlify Bot commented Sep 8, 2026

Copy link
Copy Markdown

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
druks 🟢 Ready View Preview Sep 8, 2026, 7:05 PM

💡 Tip: Enable Automations to automatically generate PRs for you.

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.

1 participant