Wrap the dev logs in a sync.Once and deregister first, to eliminate the possibility of emitting the dev output twice in a race. (#10258)
This commit is contained in:
parent
a4bcbb84e2
commit
dd0ea9a389
|
@ -1667,8 +1667,12 @@ CLUSTER_SYNTHESIS_COMPLETE:
|
||||||
}
|
}
|
||||||
|
|
||||||
var qw *quiescenceSink
|
var qw *quiescenceSink
|
||||||
|
var qwo sync.Once
|
||||||
qw = &quiescenceSink{
|
qw = &quiescenceSink{
|
||||||
t: time.AfterFunc(100*time.Millisecond, func() {
|
t: time.AfterFunc(100*time.Millisecond, func() {
|
||||||
|
qwo.Do(func() {
|
||||||
|
c.logger.DeregisterSink(qw)
|
||||||
|
|
||||||
// Print the big dev mode warning!
|
// Print the big dev mode warning!
|
||||||
c.UI.Warn(wrapAtLength(
|
c.UI.Warn(wrapAtLength(
|
||||||
"WARNING! dev mode is enabled! In this mode, Vault runs entirely " +
|
"WARNING! dev mode is enabled! In this mode, Vault runs entirely " +
|
||||||
|
@ -1732,10 +1736,8 @@ CLUSTER_SYNTHESIS_COMPLETE:
|
||||||
c.UI.Warn(wrapAtLength(
|
c.UI.Warn(wrapAtLength(
|
||||||
"Development mode should NOT be used in production installations!"))
|
"Development mode should NOT be used in production installations!"))
|
||||||
c.UI.Warn("")
|
c.UI.Warn("")
|
||||||
c.logger.DeregisterSink(qw)
|
})
|
||||||
|
})}
|
||||||
}),
|
|
||||||
}
|
|
||||||
c.logger.RegisterSink(qw)
|
c.logger.RegisterSink(qw)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue