In single server mode healthz could mistake a snapshot staging directory during a restore as an account.

If the restore took a long time, stalled, or was aborted, would cause healthz to fail.

Signed-off-by: Derek Collison <derek@nats.io>
This commit is contained in:
Derek Collison
2023-04-24 22:14:04 -07:00
parent 0e2eccd188
commit cae91b8cad
2 changed files with 37 additions and 0 deletions

View File

@@ -3083,6 +3083,9 @@ func (s *Server) healthz(opts *HealthzOptions) *HealthStatus {
// Whip through account folders and pull each stream name.
fis, _ := os.ReadDir(sdir)
for _, fi := range fis {
if fi.Name() == snapStagingDir {
continue
}
acc, err := s.LookupAccount(fi.Name())
if err != nil {
health.Status = na