diff --git a/scheduler/scheduling/scheduling.go b/scheduler/scheduling/scheduling.go index cb7d4bd58..56eede253 100644 --- a/scheduler/scheduling/scheduling.go +++ b/scheduler/scheduling/scheduling.go @@ -516,12 +516,6 @@ func (s *scheduling) filterCandidateParents(peer *resource.Peer, blocklist set.S continue } - // Candidate parent can add edge with peer. - if !peer.Task.CanAddPeerEdge(candidateParent.ID, peer.ID) { - peer.Log.Debugf("can not add edge with parent %s", candidateParent.ID) - continue - } - // Candidate parent host is not allowed to be the same as the peer host, // because dfdaemon cannot handle the situation // where two tasks are downloading and downloading each other. @@ -562,6 +556,12 @@ func (s *scheduling) filterCandidateParents(peer *resource.Peer, blocklist set.S continue } + // Candidate parent can add edge with peer. + if !peer.Task.CanAddPeerEdge(candidateParent.ID, peer.ID) { + peer.Log.Debugf("can not add edge with parent %s", candidateParent.ID) + continue + } + candidateParents = append(candidateParents, candidateParent) candidateParentIDs = append(candidateParentIDs, candidateParent.ID) }