Code Room
Code reviewHardcr-g093
Subject Partial failureLevel Senior–Staff~30 minCommon in Distributed systems interviewsIndustries Software development

Question

Review this JavaScript multi-write notifier.

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 reviewjs
async function notifyAll(userIds, message) {  if (!userIds.length) return [];  const results = await Promise.all(    userIds.map((id) => pushService.send(id, message))  );  await db.markNotified(userIds);  return results;} // callerasync function broadcast(segment, message) {  const ids = await db.usersInSegment(segment);  const sent = await notifyAll(ids, message);  metrics.incr("push.sent", sent.length);  return sent;}
Run or narrate your approach, then ask the coach.