Pure so the repetition policy is unit-testable without a router, and so the policy is stated once rather than implied by wherever a log call happens to sit.
The executor calls into this path on every tick, several times a second, while a pool's healthy count changes on the order of minutes. Warning per call reprinted one unchanged value hundreds of times a minute, which both buries the surrounding build failures and carries no information a single line did not already carry. Logging on change makes the sequence itself the signal: 3/8 -> 2/8 -> 1/3 -> recovered.
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intSentinel for "no thin-pool warning emitted yet".Method Summary
All MethodsModifier and TypeMethodDescriptionstatic StringformatThinPool(String poolName, int healthy, int target) Format the thin-pool warning body.static booleanshouldLog(int lastWarned, int healthy) Whether a thin-pool warning should be emitted for the observed healthy count.
Field Details
NEVER_WARNED
public static final int NEVER_WARNEDSentinel for "no thin-pool warning emitted yet".- See Also:
Method Details
shouldLog
public static boolean shouldLog(int lastWarned, int healthy) Whether a thin-pool warning should be emitted for the observed healthy count.Logs the first observation, then only when the count differs from the last one logged. Returning true for a repeated value would reintroduce the flood; suppressing a genuine return to a previously seen value would hide a regression-then-recovery cycle, so any difference counts as news.
- Parameters:
lastWarned- value passed to the previous call, orNEVER_WARNEDif none has been logged yethealthy- current healthy tunnel count, which may be 0- Returns:
- true if this state has not been logged before
formatThinPool
Format the thin-pool warning body.Pure, so the wording is unit-testable and cannot drift from the counts the policy decides on.
- Parameters:
poolName- pool name as produced byTunnelPool.toString()healthy- current healthy tunnel counttarget- desired healthy tunnel count- Returns:
- a single-line message suitable for WARN