From 50d27c2764e617d61ce3e1184ca7c2a0f8ad2c44 Mon Sep 17 00:00:00 2001 From: Jim Ma Date: Wed, 23 Mar 2022 15:08:34 +0800 Subject: [PATCH] chore: always fallback to legacy get pieces Signed-off-by: Jim Ma --- client/daemon/peer/peertask_piecetask_synchronizer.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/client/daemon/peer/peertask_piecetask_synchronizer.go b/client/daemon/peer/peertask_piecetask_synchronizer.go index a0b76d16a0e..e8699752e68 100644 --- a/client/daemon/peer/peertask_piecetask_synchronizer.go +++ b/client/daemon/peer/peertask_piecetask_synchronizer.go @@ -125,6 +125,7 @@ func (s *pieceTaskSyncManager) newPieceTaskSynchronizer( request.DstPid = dstPeer.PeerId client, err := dfclient.SyncPieceTasks(ctx, dstPeer, request) if err != nil { + s.peerTaskConductor.Errorf("call SyncPieceTasks error: %s, dest peer: %s", err, dstPeer.PeerId) return err } @@ -132,6 +133,7 @@ func (s *pieceTaskSyncManager) newPieceTaskSynchronizer( // when remove legacy get piece grpc, can move this check into synchronizer.receive piecePacket, err := client.Recv() if err != nil { + s.peerTaskConductor.Warnf("receive from SyncPieceTasksClient error: %s, dest peer: %s", err, dstPeer.PeerId) _ = client.CloseSend() return err } @@ -165,14 +167,14 @@ func (s *pieceTaskSyncManager) newMultiPieceTaskSynchronizer( if err == nil { continue } + legacyPeers = append(legacyPeers, peer) // when err is codes.Unimplemented, fallback to legacy get piece grpc stat, ok := status.FromError(err) if ok && stat.Code() == codes.Unimplemented { - legacyPeers = append(legacyPeers, peer) s.peerTaskConductor.Warnf("connect peer %s error: %s, fallback to legacy get piece grpc", peer.PeerId, err) } else { s.reportError(peer) - s.peerTaskConductor.Errorf("connect peer %s error: %s, not codes.Unimplemented, did not fallback to legacy", peer.PeerId, err) + s.peerTaskConductor.Errorf("connect peer %s error: %s, not codes.Unimplemented", peer.PeerId, err) } } s.cleanStaleWorker(destPeers)