Code Room
Code reviewHard
Question
Review this JavaScript SQS-style consumer.
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
async function poll() { const { Messages = [] } = await sqs.receiveMessage({ QueueUrl: ORDER_QUEUE, MaxNumberOfMessages: 10, WaitTimeSeconds: 20, }); for (const msg of Messages) { await onMessage(msg); }} async function onMessage(msg) { const order = JSON.parse(msg.body); await inventory.decrement(order.sku, order.qty); await ledger.recordSale(order); await queue.deleteMessage(msg.receiptHandle);}Run or narrate your approach, then ask the coach.