SoloMedium5m
The Connection Pool Starvation
PagerDuty — checkout 503s with healthy DB CPU
SRE Team: /api/checkout returning 503. DB CPU 10% — pool 50/50 maxed. Requests timing out waiting for connections.
The trap: DB connection held for the entire checkout including the 2s Stripe call. 50 users = pool exhausted.
Your task
Fix `process_checkout()` in `checkout_service.py`: release the connection before stripe.charge_card(), re-acquire only to save the receipt.
Book: wrap logic in one transaction · Prod: scope transactions to DB ops only.
Skills you'll prove
pythonasyncioconnection-pooltransactionsresiliencebook-vs-prod