if noone is working pick the last worker in sync wait

This commit is contained in:
vyzo 2020-10-30 19:45:59 +02:00
parent 5dcf339840
commit d6e2c80608

View File

@ -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