Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
davidcastagnetoa avatar

Request Timeout Management

  • 9 installs
  • 1 repo stars
  • Updated March 10, 2026
  • davidcastagnetoa/skills

Set per-endpoint request timeouts in Nginx and asyncio.timeout in FastAPI with clean cancellation so no request blocks resources indefinitely.

About

Configures differentiated per-endpoint timeouts at Nginx and asyncio-based cancellation in FastAPI to enforce response SLOs. A developer uses it when preventing slow requests from tying up backend resources.

  • Per-location Nginx proxy timeouts plus asyncio.timeout for clean FastAPI cancellation
  • Return 504 with session_id on timeout and alert when timeout rate exceeds 1%

Request Timeout Management by the numbers

  • 9 all-time installs (skills.sh)
  • Ranked #3,606 of 4,347 Backend & APIs skills by installs in the Skillselion catalog
  • Data as of Jul 29, 2026 (Skillselion catalog sync)
npx skills add https://github.com/davidcastagnetoa/skills --skill request_timeout_management

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs9
repo stars1
Last updatedMarch 10, 2026
Repositorydavidcastagnetoa/skills

What it does

Set per-endpoint request timeouts in Nginx and asyncio.timeout in FastAPI with clean cancellation so no request blocks resources indefinitely.

Files

SKILL.mdMarkdownGitHub ↗

request_timeout_management

Gestión de timeouts configurables por tipo de endpoint para garantizar que ninguna petición bloquee recursos indefinidamente. Alineado con el SLO de 8 segundos del pipeline KYC.

When to use

Usar en el api_gateway_agent para establecer timeouts diferenciados por endpoint. El timeout total de verificación debe ser < 8s; endpoints de consulta < 2s.

Instructions

1. Configurar timeouts en Nginx por location:

   location /v1/verify {
       proxy_read_timeout 8s;
       proxy_connect_timeout 2s;
       proxy_send_timeout 2s;
   }
   location /v1/status {
       proxy_read_timeout 2s;
   }

2. Configurar timeout global de keepalive: keepalive_timeout 65s. 3. En FastAPI, usar asyncio timeout para cancelación limpia:

   async with asyncio.timeout(7.5):  # 0.5s margen para response
       result = await orchestrator.verify(session)

4. Si timeout, devolver 504 Gateway Timeout con session_id para retry. 5. Registrar timeouts en métricas: gateway_timeouts_total{endpoint}. 6. Alertar si tasa de timeouts > 1% en ventana de 5 minutos.

Notes

  • El timeout del gateway debe ser mayor que el del backend para evitar cortar respuestas válidas.
  • Implementar client-side timeout también en los SDKs de clientes.
  • Los timeouts deben ser configurables por entorno (dev: más largos, prod: estrictos).

Related skills

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.