added FIP Cooldown before start

This commit is contained in:
ayurishchev committed 2026-08-24 10:29:08 +03:00
1 parent 291eea3eb8
commit f22ad569b6
36 files changed
+1182 -25

No files matched your search

+13 -1
View File
@@ -13,7 +13,14 @@ import (
// with "pill" in the template (e.g. `class="pill {{.Class}}"`).
type Badge struct{ Class, Label string }
func ipBadge(state, result string) Badge {
// ipBadge picks the status pill for a queue row. fipAssociatedAt/
// settleSeconds are only consulted for state=="awaiting_self_check": if
// the configured fip_settle_seconds pause (see docs/USAGE.md) hasn't
// elapsed since the floating IP was associated, the row gets a distinct
// "прогрев FIP" badge instead of looking identical to a row just waiting
// on the agent's next poll. The time math happens here, not in the
// template, same as fmtTime's existing precedent.
func ipBadge(state, result string, fipAssociatedAt *time.Time, settleSeconds int) Badge {
switch state {
case "done", "failed":
switch result {
@@ -28,6 +35,11 @@ func ipBadge(state, result string) Badge {
}
case "queued":
return Badge{"pill-neutral", "queued"}
case "awaiting_self_check":
if settleSeconds > 0 && fipAssociatedAt != nil && time.Now().Before(fipAssociatedAt.Add(time.Duration(settleSeconds)*time.Second)) {
return Badge{"pill-warning", "прогрев FIP"}
}
return Badge{"pill-info", state}
default:
return Badge{"pill-info", state}
}