Class: Pgbus::Process::ReadinessSnapshot
- Inherits:
-
Data
- Object
- Data
- Pgbus::Process::ReadinessSnapshot
- Defined in:
- lib/pgbus/process/readiness_snapshot.rb
Overview
Immutable container-local readiness state, published by the supervisor (one atomic swap per monitor pass) and read by the standalone health server's accept thread — the immutability is what makes the cross-thread handoff safe without a lock (issue #386).
expected is the child count forked by boot_processes; live is the
current fork-table size. A child sitting in crash-restart backoff keeps
live < expected, which is exactly the signal a rolling deploy's health
gate needs to fail on: the replacement container never goes ready, and
the orchestrator keeps the old container running.
Instance Attribute Summary collapse
-
#booted ⇒ Object
readonly
Returns the value of attribute booted.
-
#expected ⇒ Object
readonly
Returns the value of attribute expected.
-
#live ⇒ Object
readonly
Returns the value of attribute live.
-
#shutting_down ⇒ Object
readonly
Returns the value of attribute shutting_down.
Instance Method Summary collapse
- #ready? ⇒ Boolean
-
#status ⇒ Object
DRAINING wins over BOOTING: a supervisor told to stop mid-boot is leaving, not arriving, and must never look like it will become ready.
Instance Attribute Details
#booted ⇒ Object (readonly)
Returns the value of attribute booted
15 16 17 |
# File 'lib/pgbus/process/readiness_snapshot.rb', line 15 def booted @booted end |
#expected ⇒ Object (readonly)
Returns the value of attribute expected
15 16 17 |
# File 'lib/pgbus/process/readiness_snapshot.rb', line 15 def expected @expected end |
#live ⇒ Object (readonly)
Returns the value of attribute live
15 16 17 |
# File 'lib/pgbus/process/readiness_snapshot.rb', line 15 def live @live end |
#shutting_down ⇒ Object (readonly)
Returns the value of attribute shutting_down
15 16 17 |
# File 'lib/pgbus/process/readiness_snapshot.rb', line 15 def shutting_down @shutting_down end |
Instance Method Details
#ready? ⇒ Boolean
16 17 18 |
# File 'lib/pgbus/process/readiness_snapshot.rb', line 16 def ready? booted && !shutting_down && live >= expected end |
#status ⇒ Object
DRAINING wins over BOOTING: a supervisor told to stop mid-boot is leaving, not arriving, and must never look like it will become ready.
22 23 24 25 26 27 |
# File 'lib/pgbus/process/readiness_snapshot.rb', line 22 def status return "DRAINING" if shutting_down return "BOOTING" unless booted ready? ? "OK" : "DEGRADED" end |