Lower max_chans to length of LIST if it's shorter
This commit is contained in:
parent
153d3dd847
commit
560af8aeb0
|
@ -303,6 +303,8 @@ def keepChannels(net, listinfo, mean, sigrelay, relay):
|
||||||
# else:
|
# else:
|
||||||
# newNums = []
|
# newNums = []
|
||||||
flist = [i[0] for i in listinfo]
|
flist = [i[0] for i in listinfo]
|
||||||
|
if len(flist) > max_chans:
|
||||||
|
max_chans = len(flist)
|
||||||
chosen = sorted(flist, reverse=True, key=lambda x: x[1])[:max_chans]
|
chosen = sorted(flist, reverse=True, key=lambda x: x[1])[:max_chans]
|
||||||
debug(f"keepChannels() {net}: joining {len(chosen)}/{len(flist)} channels")
|
debug(f"keepChannels() {net}: joining {len(chosen)}/{len(flist)} channels")
|
||||||
trace(f"keepChannels() {net}: joining:{chosen}")
|
trace(f"keepChannels() {net}: joining:{chosen}")
|
||||||
|
@ -315,6 +317,8 @@ def keepChannels(net, listinfo, mean, sigrelay, relay):
|
||||||
# else:
|
# else:
|
||||||
# newNums = []
|
# newNums = []
|
||||||
siglist = [i[0] for i in listinfo if int(i[1]) > mean]
|
siglist = [i[0] for i in listinfo if int(i[1]) > mean]
|
||||||
|
if len(siglist) > max_chans:
|
||||||
|
max_chans = len(siglist)
|
||||||
chosen = sorted(siglist, reverse=True, key=lambda x: x[1])[:max_chans]
|
chosen = sorted(siglist, reverse=True, key=lambda x: x[1])[:max_chans]
|
||||||
debug(f"keepChannels() {net}: joining {len(chosen)}/{len(siglist)} channels")
|
debug(f"keepChannels() {net}: joining {len(chosen)}/{len(siglist)} channels")
|
||||||
trace(f"keepChannels() {net}: joining:{chosen}")
|
trace(f"keepChannels() {net}: joining:{chosen}")
|
||||||
|
|
Loading…
Reference in New Issue