worker: Better miner connectivity check on startup
This commit is contained in:
parent
8c86ea6b75
commit
1a10f95973
@ -172,13 +172,18 @@ var runCmd = &cli.Command{
|
||||
}
|
||||
|
||||
// Connect to storage-miner
|
||||
ctx := lcli.ReqContext(cctx)
|
||||
|
||||
var nodeApi api.StorageMiner
|
||||
var closer func()
|
||||
var err error
|
||||
for {
|
||||
nodeApi, closer, err = lcli.GetStorageMinerAPI(cctx, lcli.StorageMinerUseHttp)
|
||||
if err == nil {
|
||||
break
|
||||
_, err = nodeApi.Version(ctx)
|
||||
if err == nil {
|
||||
break
|
||||
}
|
||||
}
|
||||
fmt.Printf("\r\x1b[0KConnecting to miner API... (%s)", err)
|
||||
time.Sleep(time.Second)
|
||||
@ -186,7 +191,6 @@ var runCmd = &cli.Command{
|
||||
}
|
||||
|
||||
defer closer()
|
||||
ctx := lcli.ReqContext(cctx)
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
defer cancel()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user