Code Room
Code reviewHardcr-g537
Subject Code reviewLevel Senior–Staff~22 minCommon in Networking & APIs interviewsIndustries Software development, Technology

Question

Review this Node consumer that processes payment events from an at-least-once queue.

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 handle(msg) {  const { paymentId, amount, userId } = JSON.parse(msg.body);  await db.query(    "UPDATE accounts SET balance = balance + $1 WHERE id = $2",    [amount, userId]  );  await ledger.insert({ paymentId, amount, userId });  await msg.ack();}
Run or narrate your approach, then ask the coach.