Skip to content

feat: Add /v1/capacity endpoint, 429 handler, and optional admission gate#583

Open
prein wants to merge 2 commits into
docling-project:mainfrom
prein:feat/system-capacity
Open

feat: Add /v1/capacity endpoint, 429 handler, and optional admission gate#583
prein wants to merge 2 commits into
docling-project:mainfrom
prein:feat/system-capacity

Conversation

@prein

@prein prein commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

Depends on docling-project/docling-jobkit#126 (SystemCapacity + get_capacity()).

See #581 for full problem descriptio

Summary

  • GET /v1/capacity - returns system-level capacity snapshot (queue depth, active jobs, worker count); cached with configurable TTL (default 2s) to avoid per-request Redis scans
  • QueueLimitExceededError → 429 - fixes unhandled 500 when Ray queue limit rejection is enabled; returns capacity snapshot in response body
  • Optional admission gate - new admission_max_queue_size setting; when set, rejects submissions with 429 before enqueue() if queue is full

Issue resolved by this Pull Request:
Resolves #581

Signed-off-by: Pawel Rein <pawel.rein@prezi.com>
@github-actions

github-actions Bot commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

DCO Check Passed

Thanks @prein, all your commits are properly signed off. 🎉

@mergify

mergify Bot commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

Merge Protections

🟢 Merge protection satisfied — ready to merge.

Show 1 satisfied protection

🟢 Enforce conventional commit

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert)(?:\(.+\))?(!)?:

Signed-off-by: Paweł Rein <pawel.rein@prezi.com>
@prein

prein commented Apr 29, 2026

Copy link
Copy Markdown
Contributor Author

We are running it in our preprod environment and it works as expected. It would be amazing if you could find time to review it and hopefully merge and release so we don't have to maintain it in a fork.

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.

Expose queue capacity endpoint and handle queue-limit rejection

1 participant