Fix getting first relay when they are not sequential
This commit is contained in:
parent
c7941bfcda
commit
2a2f24f570
|
@ -138,7 +138,7 @@ def getActiveRelays(net):
|
||||||
# )
|
# )
|
||||||
if main.IRCPool[name].authenticated and main.IRCPool[name].isconnected:
|
if main.IRCPool[name].authenticated and main.IRCPool[name].isconnected:
|
||||||
activeRelays.append(i)
|
activeRelays.append(i)
|
||||||
# debug(f"getActiveRelays() {net}: {activeRelays}")
|
debug(f"getActiveRelays() {net}: {activeRelays}")
|
||||||
return activeRelays
|
return activeRelays
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import main
|
import main
|
||||||
from modules import chankeep
|
from modules import chankeep
|
||||||
|
|
||||||
# from utils.logging.debug import debug
|
from utils.logging.debug import debug
|
||||||
|
|
||||||
|
|
||||||
def get_first_relay(net):
|
def get_first_relay(net):
|
||||||
|
@ -12,10 +12,11 @@ def get_first_relay(net):
|
||||||
:return: IRCPool instance for the IRC bot
|
:return: IRCPool instance for the IRC bot
|
||||||
"""
|
"""
|
||||||
cur_relay = 0
|
cur_relay = 0
|
||||||
max_relay = len(main.network[net].relays.keys()) + 1
|
max_relay = max(main.network[net].relays.keys())
|
||||||
# debug(f"get_first_relay() {net}: max_relay:{max_relay}")
|
debug(f"get_first_relay() {net}: max_relay:{max_relay}")
|
||||||
activeRelays = chankeep.getActiveRelays(net)
|
activeRelays = chankeep.getActiveRelays(net)
|
||||||
# debug(f"get_first_relay() {net}: activeRelays:{activeRelays}")
|
|
||||||
|
debug(f"get_first_relay() {net}: activeRelays:{activeRelays}")
|
||||||
while cur_relay != max_relay:
|
while cur_relay != max_relay:
|
||||||
cur_relay += 1
|
cur_relay += 1
|
||||||
if cur_relay not in activeRelays:
|
if cur_relay not in activeRelays:
|
||||||
|
|
Loading…
Reference in New Issue