mirror of https://github.com/hashicorp/consul
guard the conversion
parent
0956e061b6
commit
ed9709a578
|
@ -4669,12 +4669,15 @@ func (a *Agent) persistServerMetadata() {
|
|||
continue
|
||||
}
|
||||
|
||||
sf := f.(*safeio.File)
|
||||
// Use safeio.File to ensure the file is written to disk atomically
|
||||
if sf, ok := f.(*safeio.File); ok {
|
||||
if err := sf.Commit(); err != nil {
|
||||
sf.Close()
|
||||
a.logger.Error("failed to commit server metadata", "error", err)
|
||||
continue
|
||||
}
|
||||
sf.Close()
|
||||
}
|
||||
f.Close()
|
||||
case <-a.shutdownCh:
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue