Code Room
Code reviewHardcr-g582
Subject Connection pool raceLevel Senior–Staff~30 minCommon in Code quality & review interviewsIndustries Software development, Technology

Question

Review this Node.js connection-pool checkout.

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
class Pool {  constructor(conns) { this.idle = conns; this.waiters = []; }   async acquire() {    while (this.idle.length === 0) {      await new Promise(res => this.waiters.push(res));    }    return this.idle.pop();  }   release(conn) {    this.idle.push(conn);    const w = this.waiters.shift();    if (w) w();  }}
Run or narrate your approach, then ask the coach.