add timeout to daemon startup
This commit is contained in:
parent
df63b91f61
commit
0308da2e4c
1 changed files with 7 additions and 2 deletions
|
@ -324,15 +324,20 @@ func (s *Sync) setChannelTerminationStatus(e *error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Sync) waitForDaemonStart() error {
|
func (s *Sync) waitForDaemonStart() error {
|
||||||
|
beginTime := time.Now()
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-s.grp.Ch():
|
case <-s.grp.Ch():
|
||||||
return errors.Err("interrupted during daemon startup")
|
return errors.Err("interrupted during daemon startup")
|
||||||
default:
|
default:
|
||||||
s, err := s.daemon.Status()
|
status, err := s.daemon.Status()
|
||||||
if err == nil && s.StartupStatus.Wallet && s.IsRunning {
|
if err == nil && status.StartupStatus.Wallet && status.IsRunning {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
if time.Since(beginTime).Minutes() > 60 {
|
||||||
|
s.grp.Stop()
|
||||||
|
return errors.Err("the daemon is taking too long to start. Something is wrong")
|
||||||
|
}
|
||||||
time.Sleep(5 * time.Second)
|
time.Sleep(5 * time.Second)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue