Code Room
Code reviewHard
Question
Review this Go handler. The incoming request has a 200ms deadline on `ctx`, but tail latency on the upstream still spikes to seconds.
What a strong answer looks like
Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.
Learn the concepts
func handler(w http.ResponseWriter, r *http.Request) { ctx := r.Context() // carries a 200ms deadline id := r.URL.Query().Get("id") user, err := lookupUser(ctx, id) if err != nil { http.Error(w, "not found", 404) return } // enrich from a slow downstream resp, _ := http.Get("https://profiles.internal/u/" + user.ID) defer resp.Body.Close() io.Copy(w, resp.Body)}Run or narrate your approach, then ask the coach.