Skip to content

fix: make get_pending_request_counts count processing and claimed too#836

Merged
jamesdborin merged 4 commits intomainfrom
fix-queue-count-include-claimed-processing
Mar 11, 2026
Merged

fix: make get_pending_request_counts count processing and claimed too#836
jamesdborin merged 4 commits intomainfrom
fix-queue-count-include-claimed-processing

Conversation

@jamesdborin
Copy link
Copy Markdown
Contributor

This pull request expands the queue depth calculation in the get_pending_request_counts API handler to provide a more comprehensive view of the queue status. Previously, only requests in the "pending" state were counted; now, requests in the "claimed" and "processing" states are also included.

Queue depth calculation improvements:

  • dwctl/src/api/handlers/queue.rs: The states vector in get_pending_request_counts was updated to include "claimed" and "processing" states, in addition to "pending", to give a more complete picture of queue depth.

Copilot AI review requested due to automatic review settings March 10, 2026 17:00
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the admin queue monitoring endpoint (get_pending_request_counts) so its “queue depth” calculation counts requests across more in-flight states, not just those strictly in pending.

Changes:

  • Expand the states filter passed to get_pending_request_counts_by_model_and_completion_window to include claimed and processing.
  • Add an inline note explaining why these additional states are included.

.map(|window| (window.clone(), parse_window_to_seconds(window)))
.collect::<Vec<_>>();
let states = vec!["pending".to_string()];
let states = vec!["pending".to_string(), "claimed".to_string(), "processing".to_string()]; // Include claimed and processing to get a more complete picture of queue depth
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

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

There are existing tests for this endpoint, but none validate the state filtering/counting logic. Since this change expands the counted states, please add an integration test that inserts requests in "pending", "claimed", and "processing" (and at least one terminal state) and asserts the endpoint includes only the intended states in its totals.

Copilot uses AI. Check for mistakes.
Comment thread dwctl/src/api/handlers/queue.rs
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Mar 11, 2026

Deploying control-layer with  Cloudflare Pages  Cloudflare Pages

Latest commit: 5d63525
Status: ✅  Deploy successful!
Preview URL: https://b8362aca.control-layer.pages.dev
Branch Preview URL: https://fix-queue-count-include-clai.control-layer.pages.dev

View logs

@jamesdborin jamesdborin added this pull request to the merge queue Mar 11, 2026
Merged via the queue into main with commit ae6fbda Mar 11, 2026
8 checks passed
github-merge-queue Bot pushed a commit that referenced this pull request Mar 11, 2026
🤖 I have created a release *beep* *boop*
---


##
[8.18.0](v8.17.1...v8.18.0)
(2026-03-11)


### Features

* allow email reuse in orgs with updated unique indx on user emails
([#853](#853))
([f4ca358](f4ca358))
* migration to allow org members to have the same api key name
([#857](#857))
([09b6001](09b6001))
* use last_login column to detect first login and redirect onboarding
([#835](#835))
([45f5138](45f5138))


### Bug Fixes

* make get_pending_request_counts count processing and claimed too
([#836](#836))
([ae6fbda](ae6fbda))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).
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