Don't touch ActiveTime in preSeal/postUnseal (#24549)

This commit is contained in:
Nick Cabatoff
2023-12-15 08:59:29 -05:00
committed by GitHub
parent 24c6e82a84
commit 763095fec6
3 changed files with 5 additions and 2 deletions

3
changelog/24549.txt Normal file
View File

@@ -0,0 +1,3 @@
```release-note:bug
api: sys/leader ActiveTime field no longer gets reset when we do an internal state change that doesn't change our active status.
```

View File

@@ -2390,7 +2390,6 @@ func (s standardUnsealStrategy) unseal(ctx context.Context, logger log.Logger, c
// Mark the active time. We do this first so it can be correlated to the logs
// for the active startup.
c.activeTime = time.Now().UTC()
if err := postUnsealPhysical(c); err != nil {
return err
@@ -2766,7 +2765,6 @@ func (c *Core) preSeal() error {
}
// Clear any pending funcs
c.postUnsealFuncs = nil
c.activeTime = time.Time{}
// Clear any rekey progress
c.barrierRekeyConfig = nil

View File

@@ -663,6 +663,7 @@ func (c *Core) waitForLeadership(newLeaderCh chan func(), manualStepDownCh, stop
err = c.postUnseal(activeCtx, activeCtxCancel, standardUnsealStrategy{})
if err == nil {
c.standby = false
c.activeTime = time.Now()
c.leaderUUID = uuid
c.metricSink.SetGaugeWithLabels([]string{"core", "active"}, 1, nil)
}
@@ -715,6 +716,7 @@ func (c *Core) waitForLeadership(newLeaderCh chan func(), manualStepDownCh, stop
// Mark as standby
c.standby = true
c.activeTime = time.Time{}
c.leaderUUID = ""
c.metricSink.SetGaugeWithLabels([]string{"core", "active"}, 0, nil)