Concurrency Limiting ABCs#
ConcurrencyLimiterProto
#
Bases: Protocol[ClientT]
A protocol for valid concurrency limiters that arc
can use.
Tip
An easy (but not necessary) way to ensure you've implemented all methods is to inherit from this protocol.
HasConcurrencyLimiter
#
A trait for objects that can have a concurrency limiter.
concurrency_limiter
abstractmethod
property
writable
#
concurrency_limiter: ConcurrencyLimiterProto[ClientT] | None
The concurrency limiter for this object.
set_concurrency_limiter
#
set_concurrency_limiter(limiter: ConcurrencyLimiterProto[ClientT]) -> Self
Set the concurrency limiter for this object.
with_concurrency_limit
#
with_concurrency_limit(
limiter: ConcurrencyLimiterProto[ClientT],
) -> Callable[[HasConcurrencyLimiterT], HasConcurrencyLimiterT]
A decorator that sets a concurrency limiter for an object.
Note
An object can only have one concurrency limiter set at a time.
PARAMETER | DESCRIPTION |
---|---|
limiter |
The concurrency limiter to use.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
Callable[[HasConcurrencyLimiterT], HasConcurrencyLimiterT]
|
The object with the concurrency limiter set. |