Code RoomBlocking IO in async handler
HardPrep Room Coding #1919

Blocking IO in async handler

Code reviewConcurrencyMid–Senior~20 min

Review this async request handler. Tail latency on the whole service got worse after this endpoint shipped, even for unrelated routes.

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.

0:00 of about 20 min
Mark a line and say what kind of problem it is.0 findings
1import time, requests
2 
3async def enrich(request):
4 user = request.user_id
5 # call the profile service
6 resp = requests.get(f"https://profiles.internal/u/{user}", timeout=2)
7 time.sleep(0.05) # small backoff before responding
8 return {"profile": resp.json()}
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.