From 5dcf339840a886989cbb83817f92f4c45b869095 Mon Sep 17 00:00:00 2001 From: vyzo Date: Fri, 30 Oct 2020 19:28:32 +0200 Subject: [PATCH] fix sync wait cli --- cli/sync.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cli/sync.go b/cli/sync.go index b4e26f7d8..7527493d4 100644 --- a/cli/sync.go +++ b/cli/sync.go @@ -263,6 +263,11 @@ func SyncWait(ctx context.Context, napi api.FullNode, watch bool) error { return err } + if len(state.ActiveSyncs) == 0 { + time.Sleep(time.Second) + continue + } + head, err := napi.ChainHead(ctx) if err != nil { return err @@ -280,6 +285,7 @@ func SyncWait(ctx context.Context, napi api.FullNode, watch bool) error { } ss := state.ActiveSyncs[working] + workerID := ss.WorkerID var baseHeight abi.ChainEpoch var target []cid.Cid @@ -302,7 +308,7 @@ func SyncWait(ctx context.Context, napi api.FullNode, watch bool) error { fmt.Print("\r\x1b[2K\x1b[A") } - fmt.Printf("Worker: %d; Base: %d; Target: %d (diff: %d)\n", working, baseHeight, theight, heightDiff) + fmt.Printf("Worker: %d; Base: %d; Target: %d (diff: %d)\n", workerID, baseHeight, theight, heightDiff) fmt.Printf("State: %s; Current Epoch: %d; Todo: %d\n", ss.Stage, ss.Height, theight-ss.Height) lastLines = 2