feat: CanAddPeerEdge is moved to the end of filter (#3036)

Signed-off-by: Gaius <gaius.qi@gmail.com>
This commit is contained in:
Gaius 2024-01-19 16:43:30 +08:00 committed by GitHub
parent 2f04697d14
commit a38a4578c3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 6 deletions

View File

@ -516,12 +516,6 @@ func (s *scheduling) filterCandidateParents(peer *resource.Peer, blocklist set.S
continue 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, // Candidate parent host is not allowed to be the same as the peer host,
// because dfdaemon cannot handle the situation // because dfdaemon cannot handle the situation
// where two tasks are downloading and downloading each other. // where two tasks are downloading and downloading each other.
@ -562,6 +556,12 @@ func (s *scheduling) filterCandidateParents(peer *resource.Peer, blocklist set.S
continue 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) candidateParents = append(candidateParents, candidateParent)
candidateParentIDs = append(candidateParentIDs, candidateParent.ID) candidateParentIDs = append(candidateParentIDs, candidateParent.ID)
} }