Code Room
Code reviewHardcr-g512
Subject Timeout handlingLevel Senior–Staff~18 minCommon in Code quality & review interviewsIndustries Software development, Technology

Question

Review this Go handler. The incoming request has a deadline on `r.Context()`, but the DB call ignores it.

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.

Talk through your review
Code to reviewgo
func handler(w http.ResponseWriter, r *http.Request) {    rows, err := db.QueryContext(context.Background(), heavyQuery)    if err != nil {        http.Error(w, "error", 500); return    }    defer rows.Close()    // ... stream rows to w ...}
Run or narrate your approach, then ask the coach.