Skip to main content

Module subscribers

Module subscribers 

Source
Expand description

How many streams this server holds open at once, and how many of them one caller may hold.

com.atproto.sync.subscribeRepos is the route whose answer does not end. Every other route’s cost is bounded by crate::MAX_CONCURRENT_REQUESTS, which releases its permit once the response head is sent — which for a stream is immediately, and for the next hour of that stream’s life is nothing at all. What each one keeps after that is a task and a frame in flight per subscriber, and the routes are public, so without a bound of their own a caller can open them until the process runs out of memory.

Two bounds, for the reason crate::rate_limit’s own doc gives for its two: a total, which is the resource actually shared, and a per-address one, so a single caller cannot spend the whole total on its own. A slot is held for the life of the stream rather than the life of the request, which is what makes it a bound on concurrency rather than on arrival rate.

Structs§

Counts 🔒
SubscriberLimit
The two bounds, and what is currently held against them.
SubscriberSlot
One open stream’s claim on SubscriberLimit, released when it drops.

Constants§

DEFAULT_MAX_SUBSCRIBERS
How many streams this server holds open across every caller.
DEFAULT_MAX_SUBSCRIBERS_PER_CALLER
How many of those one caller address may hold.