forked from LBRYCommunity/lbry-sdk
do not limit DHT results by K, respect max_results
This commit is contained in:
parent
3d5c9cc1c2
commit
54d6fb9da4
1 changed files with 1 additions and 1 deletions
|
@ -286,7 +286,7 @@ class IterativeNodeFinder(IterativeFinder):
|
||||||
and self.peer_manager.peer_is_good(peer) is not False
|
and self.peer_manager.peer_is_good(peer) is not False
|
||||||
]
|
]
|
||||||
not_yet_yielded.sort(key=lambda peer: self.distance(peer.node_id))
|
not_yet_yielded.sort(key=lambda peer: self.distance(peer.node_id))
|
||||||
to_yield = not_yet_yielded[:min(constants.K, len(not_yet_yielded))]
|
to_yield = not_yet_yielded[:max(constants.K, self.max_results)]
|
||||||
if to_yield:
|
if to_yield:
|
||||||
self.yielded_peers.update(to_yield)
|
self.yielded_peers.update(to_yield)
|
||||||
self.iteration_queue.put_nowait(to_yield)
|
self.iteration_queue.put_nowait(to_yield)
|
||||||
|
|
Loading…
Reference in a new issue