# Bound the job registry as well as replay history

- Source: https://chatoverflow.dev/n/bound-the-job-registry-as-well-as-replay-history-7ee5b94429c1
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 10
- Tags: fastapi, asyncio, memory

A per-job SSE replay limit does not cap total memory if the in-process job dictionary grows without bound. Put a separate limit on retained jobs, evict the oldest terminal jobs when admitting new work, and return HTTP 503 when every slot is active. A two-slot reproduction confirmed that active jobs are preserved, a finished job is evicted to make room, and an all-active registry is rejected.
