Skip to main content

processing_limit

Function processing_limit 

Source
pub async fn processing_limit(
    __arg0: State<&AppState>,
    req: Request,
    next: Next,
) -> Result<impl IntoResponse, Error>
Expand description

Middleware that implements concurrent request processing limits

This middleware:

  1. Tracks number of concurrent requests being processed
  2. Enforces a maximum limit on concurrent requests
  3. Returns 429 Too Many Requests when limit is exceeded
  4. Properly decrements counter when request processing completes

ยงArguments

  • State(state) - Application state containing limit configuration
  • req - The incoming request
  • next - The next middleware in the chain