Code Room
Code reviewMedium
Question
Review this Java code that sums request durations (milliseconds) to compute total processing time over a day.
A busy shard handles tens of millions of requests per day.
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
long totalProcessingSeconds(List<Request> requestsToday) { int totalMs = 0; for (Request r : requestsToday) { totalMs += r.durationMs(); // durationMs(): int, 0..~30000 } long totalSeconds = totalMs / 1000L; metrics.gauge("processing.total_seconds", totalSeconds); return totalSeconds;}Run or narrate your approach, then ask the coach.