mirror of
https://github.com/datarhei/core.git
synced 2025-09-27 04:16:25 +08:00
Add timeout for waiting for state
This commit is contained in:
@@ -802,7 +802,12 @@ func (p *process) stop(wait bool, reason string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If the process in starting state, wait until the process has been started
|
// If the process in starting state, wait until the process has been started
|
||||||
|
start := time.Now()
|
||||||
for {
|
for {
|
||||||
|
if time.Since(start) > 5*time.Second {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
if p.getState() == stateStarting {
|
if p.getState() == stateStarting {
|
||||||
time.Sleep(100 * time.Millisecond)
|
time.Sleep(100 * time.Millisecond)
|
||||||
continue
|
continue
|
||||||
|
Reference in New Issue
Block a user