mirror of
https://github.com/planetmint/planetmint-go.git
synced 2025-11-24 06:25:47 +00:00
stageing network takedown to avoid leveldb panics
Signed-off-by: Jürgen Eckel <juergen@riddleandcode.com>
This commit is contained in:
parent
06e60809ca
commit
35d0299ffd
@ -749,13 +749,9 @@ func (n *Network) Cleanup() {
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
n.Logger.Log("cleaning up test network...")
|
n.Logger.Log("cleaning up test network...")
|
||||||
|
n.Logger.Log("Stage 1 APIs...")
|
||||||
for i := len(n.Validators) - 1; i >= 0; i-- {
|
for i := len(n.Validators) - 1; i >= 0; i-- {
|
||||||
v := n.Validators[i]
|
v := n.Validators[i]
|
||||||
if v.tmNode != nil && v.tmNode.IsRunning() {
|
|
||||||
_ = v.tmNode.Stop()
|
|
||||||
}
|
|
||||||
|
|
||||||
if v.api != nil {
|
if v.api != nil {
|
||||||
_ = v.api.Close()
|
_ = v.api.Close()
|
||||||
}
|
}
|
||||||
@ -767,6 +763,15 @@ func (n *Network) Cleanup() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
n.Logger.Log("Stage 2 CometBFT...")
|
||||||
|
for i := len(n.Validators) - 1; i >= 0; i-- {
|
||||||
|
v := n.Validators[i]
|
||||||
|
if v.tmNode != nil && v.tmNode.IsRunning() {
|
||||||
|
_ = v.tmNode.Stop()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
n.Logger.Log("Stage 3 Application Threads...")
|
||||||
// waiting for all threads to be terminated
|
// waiting for all threads to be terminated
|
||||||
util.TerminationWaitGroup.Wait()
|
util.TerminationWaitGroup.Wait()
|
||||||
|
|
||||||
@ -774,6 +779,7 @@ func (n *Network) Cleanup() {
|
|||||||
// 100ms chosen randomly.
|
// 100ms chosen randomly.
|
||||||
time.Sleep(100 * time.Millisecond)
|
time.Sleep(100 * time.Millisecond)
|
||||||
|
|
||||||
|
n.Logger.Log("Stage 4 Files...")
|
||||||
if n.Config.CleanupDir {
|
if n.Config.CleanupDir {
|
||||||
_ = os.RemoveAll(n.BaseDir)
|
_ = os.RemoveAll(n.BaseDir)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user