mirror of
https://github.com/internetarchive/brozzler.git
synced 2025-07-24 15:25:40 -04:00
maybe fewer warcproxes
This commit is contained in:
parent
d190122a6d
commit
f8f7aa1dca
1 changed files with 4 additions and 1 deletions
|
@ -82,8 +82,11 @@ class BrozzlerWorker:
|
||||||
if not warcproxes:
|
if not warcproxes:
|
||||||
return None
|
return None
|
||||||
warcproxes.sort(key=lambda warcprox: (warcprox['load']))
|
warcproxes.sort(key=lambda warcprox: (warcprox['load']))
|
||||||
|
num_choices = 5
|
||||||
|
if len(warcproxes) < num_choices:
|
||||||
|
num_choices = len(warcproxes)
|
||||||
# XXX make this heuristic more advanced?
|
# XXX make this heuristic more advanced?
|
||||||
return random.choice(warcproxes[0:5])
|
return random.choice(warcproxes[0:num_choices])
|
||||||
|
|
||||||
def _proxy_for(self, site):
|
def _proxy_for(self, site):
|
||||||
if self._proxy:
|
if self._proxy:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue