From a9592a85d009667f7dda0b37e564a92e937df05a Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Mon, 15 Aug 2022 00:27:16 +0100 Subject: [PATCH] Fix variable placement --- modules/chankeep.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/modules/chankeep.py b/modules/chankeep.py index 48e5741..607dddb 100644 --- a/modules/chankeep.py +++ b/modules/chankeep.py @@ -302,10 +302,11 @@ def keepChannels(net, listinfo, mean, sigrelay, relay): # newNums = modules.provision.provisionMultipleRelays(net, needed) # else: # newNums = [] - if len(flist) > max_chans: - max_chans = len(flist)-1 - chosen = sorted(flist, reverse=True, key=lambda x: x[1])[:max_chans] flist = [i[0] for i in listinfo] + if len(flist) > max_chans: + max_chans = len(flist) - 1 + chosen = sorted(flist, reverse=True, key=lambda x: x[1])[:max_chans] + debug(f"keepChannels() {net}: joining {len(chosen)}/{len(flist)} channels") trace(f"keepChannels() {net}: joining:{chosen}") populateChans(net, chosen) @@ -317,10 +318,11 @@ def keepChannels(net, listinfo, mean, sigrelay, relay): # else: # newNums = [] siglist = [i for i in listinfo if int(i[1]) > mean] + if len(siglist) > max_chans: + max_chans = len(siglist) - 1 chosen = sorted(siglist, reverse=True, key=lambda x: x[1])[:max_chans] siglist = [i[0] for i in siglist] - if len(siglist) > max_chans: - max_chans = len(siglist)-1 + debug(f"keepChannels() {net}: siglist:{siglist} max_chans:{max_chans} len_sig:{len(siglist)}") debug(f"keepChannels() {net}: joining {len(chosen)}/{len(siglist)} channels") trace(f"keepChannels() {net}: joining:{chosen}")