IK
Interview Knowledge Book
Topics
Practice
Examples
Playground
RU
browser
Bounded queue backpressure
Reject excess work when a bounded queue is full instead of accepting infinite latency.
index.js
const queue = []; const limit = 2; function enqueue(job) { if (queue.length >= limit) return console.log('rejected', job); queue.push(job); console.log('accepted', job); } enqueue('job-1'); enqueue('job-2'); enqueue('job-3');
Run
Stop
Reset