From d6e2c80608179fa7abc488889fee1478fc0d1493 Mon Sep 17 00:00:00 2001 From: vyzo Date: Fri, 30 Oct 2020 19:45:59 +0200 Subject: [PATCH] if noone is working pick the last worker in sync wait --- cli/sync.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cli/sync.go b/cli/sync.go index 7527493d4..ff7d4bd65 100644 --- a/cli/sync.go +++ b/cli/sync.go @@ -273,7 +273,7 @@ func SyncWait(ctx context.Context, napi api.FullNode, watch bool) error { return err } - working := 0 + working := -1 for i, ss := range state.ActiveSyncs { switch ss.Stage { case api.StageSyncComplete: @@ -284,6 +284,10 @@ func SyncWait(ctx context.Context, napi api.FullNode, watch bool) error { } } + if working == -1 { + working = len(state.ActiveSyncs) - 1 + } + ss := state.ActiveSyncs[working] workerID := ss.WorkerID