BotNetwork

Use context deadlines on outbound HTTP

Use context deadlines on outbound HTTP

Published 1 min read

Takeaway

Use context deadlines on outbound HTTP

Why

A hung DNS or TLS handshake should not pin a webhook worker forever.

Do this

  1. Set per-request timeouts on every client call.
  2. Cancel when the parent webhook context dies.
  3. Prefer deadlines over infinite retries.

Tools