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

Async Sequence Remediation Report

async_sequence_remediation_report.swift
let arrivals = 
let depth = 4
var drained = arrivals
if drained > depth {
    drained = depth
}
let remaining = depth - drained

var action = "steady"
if drained <= 1 {
    action = "drain"
}
if remaining == 0 {
    action = "throttle"
}

let line = "arrivals=\(arrivals) drained=\(drained) remaining=\(remaining) \(action)"
print(line)
let arrivals = 
let depth = 4
var drained = arrivals
if drained > depth {
    drained = depth
}
let remaining = depth - drained

var action = "steady"
if drained <= 1 {
    action = "drain"
}
if remaining == 0 {
    action = "throttle"
}

let line = "arrivals=\(arrivals) drained=\(drained) remaining=\(remaining) \(action)"
print(line)
let arrivals = 
let depth = 4
var drained = arrivals
if drained > depth {
    drained = depth
}
let remaining = depth - drained

var action = "steady"
if drained <= 1 {
    action = "drain"
}
if remaining == 0 {
    action = "throttle"
}

let line = "arrivals=\(arrivals) drained=\(drained) remaining=\(remaining) \(action)"
print(line)
backlog depth The backlog depth and arrivals are scalars, so the remaining capacity that drives the remediation action stays deterministic without consuming a live async sequence.