feat(servers): 新建服务器默认空闲 10 分钟自动停服,面板可调,converge 回填旧服,系统服不休眠

This commit is contained in:
Lemon-miaow committed 2026-09-24 16:12:53 +08:00
1 parent bd909d5858
commit c1796bea17
23 files changed
+453 -18

No files matched your search

@@ -226,7 +226,23 @@ type StartupSpec struct {
HealthHTTPPath string `json:"healthHTTPPath,omitempty"`
}
// DefaultEmptySecondsBeforeStop is how long a user server may sit empty before
// idle auto-stop scales it down, when nobody chose another value (spec §8).
const DefaultEmptySecondsBeforeStop int32 = 600
// DefaultIdle is the idle policy every user server is created with: stop after
// DefaultEmptySecondsBeforeStop of an empty server. System servers (the login
// gate, the lobby) never take it; they must stay up.
func DefaultIdle() IdleSpec {
return IdleSpec{AutoStopEnabled: true, EmptySecondsBeforeStop: DefaultEmptySecondsBeforeStop}
}
// IdleSpec configures empty-server auto-stop (spec §8).
//
// The two fields together tell a choice from its absence: turning auto-stop
// off keeps EmptySecondsBeforeStop set (AutoStopEnabled=false, seconds > 0),
// while a server that predates the default has both zero, and only that one
// is filled in by `felis converge`.
type IdleSpec struct {
// AutoStopEnabled turns on idle auto-stop.
AutoStopEnabled bool `json:"autoStopEnabled,omitempty"`