Drain a fixed backlog of arrivals against a bounded depth and turn the remaining depth into a drain, steady, or throttle remediation action.

Async Queue Remediation Report

async_queue.ts
const arrivals: number = ;
const depth: number = 4;
let drained: number = arrivals;
if (drained > depth) {
    drained = depth;
}
const remaining: number = depth - drained;

let action: string = "steady";
if (drained <= 1) {
    action = "drain";
}
if (remaining === 0) {
    action = "throttle";
}

console.log(`arrivals=${arrivals} drained=${drained} remaining=${remaining} ${action}`);
const arrivals: number = ;
const depth: number = 4;
let drained: number = arrivals;
if (drained > depth) {
    drained = depth;
}
const remaining: number = depth - drained;

let action: string = "steady";
if (drained <= 1) {
    action = "drain";
}
if (remaining === 0) {
    action = "throttle";
}

console.log(`arrivals=${arrivals} drained=${drained} remaining=${remaining} ${action}`);
const arrivals: number = ;
const depth: number = 4;
let drained: number = arrivals;
if (drained > depth) {
    drained = depth;
}
const remaining: number = depth - drained;

let action: string = "steady";
if (drained <= 1) {
    action = "drain";
}
if (remaining === 0) {
    action = "throttle";
}

console.log(`arrivals=${arrivals} drained=${drained} remaining=${remaining} ${action}`);
backlog depth The backlog depth and arrivals are scalars, so the remaining capacity that drives the remediation action stays deterministic without draining a live async queue.