Code Room
Code reviewHard
Question
An AI generated this fixed-window rate limiter. Review 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.
Learn the concepts
def allow(user, now): bucket = windows.setdefault(user, {'start': now, 'count': 0}) if now - bucket['start'] > 60: bucket['count'] = 0 bucket['count'] += 1 return bucket['count'] <= LIMITRun or narrate your approach, then ask the coach.