Skip to content

Add fastapi-stream-lease - #132

Closed
agustin18 wants to merge 1 commit into
timofurrer:mainfrom
agustin18:add-fastapi-stream-lease
Closed

agustin18 wants to merge 1 commit into
timofurrer:mainfrom
agustin18:add-fastapi-stream-lease

Conversation

@agustin18

Copy link
Copy Markdown

What is this project?

fastapi-stream-lease is an async concurrency lease manager for long-lived streaming endpoints (SSE, WebSockets, and LLM chat completions) in FastAPI and Starlette.

Why is it awesome?

  • Solves the active connection problem: standard token-bucket limiters count requests per minute, which fails when an SSE completion stays open for 30–60 seconds. fastapi-stream-lease tracks active open connections in real time across workers using Redis sorted sets and atomic Lua CAS.
  • Guaranteed resource cleanup: immediately releases concurrency slots when downstream clients disconnect (aclose cancellation), preventing orphaned background generation.
  • Production readiness: 100.00% statement and branch test coverage, multi-version CI (Python 3.10–3.13), Redis Sentinel and Cluster failover protection, and Prometheus/OpenTelemetry metrics.
  • Published on PyPI (pip install fastapi-stream-lease) under the MIT license.

@agustin18 agustin18 closed this Oct 20, 2026
@agustin18
agustin18 deleted the add-fastapi-stream-lease branch October 20, 2026 22:34
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