Operational Remediation Reports
Sized Queue Capacity Remediation Report
Admit offered work against a fixed capacity and turn the remaining slots into an admit, hold, or shed remediation action.
Sized Queue Capacity Remediation Report
sized_queue_capacity_remediation_report.rb
offered =
capacity = 3
accepted = 0
offered.times do
accepted += 1 if accepted < capacity
end
remaining = capacity - accepted
action = if remaining >= 2
"admit"
elsif remaining == 1
"hold"
else
"shed"
end
puts "offered=#{offered}"
puts "accepted=#{accepted}"
puts "remaining=#{remaining}"
puts "action=#{action}"
offered =
capacity = 3
accepted = 0
offered.times do
accepted += 1 if accepted < capacity
end
remaining = capacity - accepted
action = if remaining >= 2
"admit"
elsif remaining == 1
"hold"
else
"shed"
end
puts "offered=#{offered}"
puts "accepted=#{accepted}"
puts "remaining=#{remaining}"
puts "action=#{action}"
offered =
capacity = 3
accepted = 0
offered.times do
accepted += 1 if accepted < capacity
end
remaining = capacity - accepted
action = if remaining >= 2
"admit"
elsif remaining == 1
"hold"
else
"shed"
end
puts "offered=#{offered}"
puts "accepted=#{accepted}"
puts "remaining=#{remaining}"
puts "action=#{action}"
remaining capacity
The fixed capacity is modeled with a scalar counter, so the remaining slots stay deterministic and free of object identity while driving the remediation action.