test lbrycrd connection before sending

This commit is contained in:
Alex Grintsvayg 2017-11-21 13:53:56 -05:00
parent 68c8e4c3ea
commit ad4f7c530c
No known key found for this signature in database
GPG key ID: AEB3F089F86A22B5
2 changed files with 7 additions and 1 deletions

View file

@ -64,6 +64,12 @@ func New(lbrycrdURL string) (*Client, error) {
return nil, errors.Wrap(err, 0) return nil, errors.Wrap(err, 0)
} }
// make sure lbrycrd is running and responsive
_, err = client.GetInfo()
if err != nil {
return nil, errors.Wrap(err, 0)
}
return &Client{client}, nil return &Client{client}, nil
} }

View file

@ -58,7 +58,7 @@ func (s *Sync) initDaemon() {
if err == nil { if err == nil {
break break
} }
time.Sleep(2 * time.Second) time.Sleep(5 * time.Second)
} }
} }
} }