Figure out the channel parsing logic
This commit is contained in:
parent
2b7bd486f1
commit
e56bd61362
|
@ -302,15 +302,16 @@ def keepChannels(net, listinfo, mean, sigrelay, relay):
|
||||||
# newNums = modules.provision.provisionMultipleRelays(net, needed)
|
# newNums = modules.provision.provisionMultipleRelays(net, needed)
|
||||||
# else:
|
# else:
|
||||||
# newNums = []
|
# newNums = []
|
||||||
flist = [i[0] for i in listinfo]
|
listinfo_sort = sorted(listinfo, reverse=True, key=lambda x: x[1])
|
||||||
if len(flist) > max_chans:
|
if len(listinfo_sort) > max_chans:
|
||||||
max_chans = len(flist) - 1
|
max_chans = len(listinfo_sort) - 1
|
||||||
chosen = sorted(flist, reverse=True, key=lambda x: x[1])[:max_chans]
|
|
||||||
chosen = [i[0] for i in chosen]
|
|
||||||
|
|
||||||
debug(f"keepChannels() {net}: joining {len(chosen)}/{len(flist)} channels")
|
flist = [i[0] for i in listinfo_sort]
|
||||||
trace(f"keepChannels() {net}: joining:{chosen}")
|
|
||||||
populateChans(net, chosen)
|
flist = flist[:max_chans]
|
||||||
|
debug(f"keepChannels() {net}: joining {len(flist)}/{len(listinfo_sort)} channels")
|
||||||
|
trace(f"keepChannels() {net}: joining:{flist}")
|
||||||
|
populateChans(net, flist)
|
||||||
else:
|
else:
|
||||||
# needed = sigrelay - len(getActiveRelays(net))
|
# needed = sigrelay - len(getActiveRelays(net))
|
||||||
# if needed:
|
# if needed:
|
||||||
|
@ -318,16 +319,18 @@ def keepChannels(net, listinfo, mean, sigrelay, relay):
|
||||||
# newNums = modules.provision.provisionMultipleRelays(net, needed)
|
# newNums = modules.provision.provisionMultipleRelays(net, needed)
|
||||||
# else:
|
# else:
|
||||||
# newNums = []
|
# newNums = []
|
||||||
siglist = [i for i in listinfo if int(i[1]) > mean]
|
listinfo_sort = sorted(listinfo, reverse=True, key=lambda x: x[1])
|
||||||
if len(siglist) > max_chans:
|
if len(listinfo_sort) > max_chans:
|
||||||
max_chans = len(siglist) - 1
|
max_chans = len(listinfo_sort) - 1
|
||||||
chosen = sorted(siglist, reverse=True, key=lambda x: x[1])[:max_chans]
|
|
||||||
chosen = [i[0] for i in chosen]
|
|
||||||
|
|
||||||
debug(f"keepChannels() {net}: siglist:{siglist} max_chans:{max_chans} len_sig:{len(siglist)}")
|
siglist = [i[0] for i in listinfo if int(i[1]) > mean]
|
||||||
debug(f"keepChannels() {net}: joining {len(chosen)}/{len(siglist)} channels")
|
|
||||||
trace(f"keepChannels() {net}: joining:{chosen}")
|
siglist = siglist[:max_chans]
|
||||||
populateChans(net, chosen)
|
|
||||||
|
debug(f"keepChannels() {net}: siglist:{siglist} max_chans:{max_chans} len_sig:{len(listinfo_sort)}")
|
||||||
|
debug(f"keepChannels() {net}: joining {len(siglist)}/{len(listinfo_sort)} channels")
|
||||||
|
trace(f"keepChannels() {net}: joining:{siglist}")
|
||||||
|
populateChans(net, siglist)
|
||||||
notifyJoin(net)
|
notifyJoin(net)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue