feat: add precise diagnostics and optional client copy logging controls

This commit is contained in:
2026-09-26 18:04:33 +08:00
parent 69585dab61
commit 3bbc6f60d7
44 changed files with 1529 additions and 84 deletions

View File

@@ -7,6 +7,8 @@ import (
"strings"
"time"
"unicode"
"git.yuntuo.hk/k2safe/go-omni/internal/configdiag"
)
// ErrResourcesRetained means background quiescence could not be established.
@@ -24,8 +26,13 @@ func DefaultShutdownConfig() ShutdownConfig {
return ShutdownConfig{StopTimeout: 5 * time.Second, DrainTimeout: 10 * time.Second, CancelTimeout: 5 * time.Second}
}
func (c ShutdownConfig) Validate() error {
if c.StopTimeout < 0 || c.DrainTimeout < 0 || c.CancelTimeout < 0 {
return errors.New("lifecycle: shutdown timeouts must be nonnegative")
for _, f := range []struct {
name string
value time.Duration
}{{"stopTimeout", c.StopTimeout}, {"drainTimeout", c.DrainTimeout}, {"cancelTimeout", c.CancelTimeout}} {
if f.value < 0 {
return configdiag.New(f.name, "must be nonnegative")
}
}
return nil
}