From 1a10f95973caaf7869b100228210aa612c57d49f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Sun, 18 Oct 2020 19:53:23 +0200 Subject: [PATCH] worker: Better miner connectivity check on startup --- cmd/lotus-seal-worker/main.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cmd/lotus-seal-worker/main.go b/cmd/lotus-seal-worker/main.go index 5575679dd..9073c860e 100644 --- a/cmd/lotus-seal-worker/main.go +++ b/cmd/lotus-seal-worker/main.go @@ -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()