Skip to content

Commit

Permalink
do not limit DHT results by K, respect max_results
Browse files Browse the repository at this point in the history
  • Loading branch information
shyba committed Dec 8, 2021
1 parent 442326f commit 8667bf5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lbry/dht/protocol/iterative_find.py
Expand Up @@ -285,7 +285,7 @@ def put_result(self, from_iter: typing.Iterable['KademliaPeer'], finish=False):
and self.peer_manager.peer_is_good(peer) is not False
]
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:
self.yielded_peers.update(to_yield)
self.iteration_queue.put_nowait(to_yield)
Expand Down

0 comments on commit 8667bf5

Please sign in to comment.