Operational Remediation Reports
Async Queue Remediation Report
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_remediation.js
const arrivals = 1;
const depth = 4;
function remediate(count) {
let drained = count;
if (drained > depth) {
drained = depth;
}
const remaining = depth - drained;
let action = "steady";
if (drained <= 1) {
action = "drain";
} else if (remaining === 0) {
action = "throttle";
}
console.log(`arrivals=${count} drained=${drained} remaining=${remaining} ${action}`);
}
remediate(arrivals);
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.