Add more LIST handling debugging

This commit is contained in:
Mark Veidemanis 2022-08-11 20:18:49 +01:00
parent ea81fc80e3
commit 11c226833d
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
1 changed files with 12 additions and 5 deletions

View File

@ -127,8 +127,10 @@ class IRCBot(IRCClient):
error("%s - Cannot join channel we are already on: %s - %i" % (i, self.net, self.num)) error("%s - Cannot join channel we are already on: %s - %i" % (i, self.net, self.num))
def checkChannels(self): def checkChannels(self):
if not chankeep.allRelaysActive(self.net): if chankeep.allRelaysActive(self.net):
debug("Skipping channel check as we have inactive relays: %s - %i" % (self.net, self.num)) debug(f"checkChannels() all relays active for {self.net}")
else:
debug("checkChannels() skipping channel check as we have inactive relays: %s - %i" % (self.net, self.num))
return return
if self.net in main.TempChan.keys(): if self.net in main.TempChan.keys():
if self.num in main.TempChan[self.net].keys(): if self.num in main.TempChan[self.net].keys():
@ -457,24 +459,29 @@ class IRCBot(IRCClient):
def recheckList(self): def recheckList(self):
allRelays = chankeep.allRelaysActive(self.net) allRelays = chankeep.allRelaysActive(self.net)
debug(f"recheckList() all relays for {self.net} {allRelays}")
if allRelays: if allRelays:
debug(f"All relays active for {self.net}") debug(f"recheckList() all relays active for {self.net}")
first_relay = helpers.get_first_relay(self.net) first_relay = helpers.get_first_relay(self.net)
debug(f"recheckList() first relay for {self.net}: {first_relay.num}")
if first_relay: if first_relay:
if first_relay.wantList is True: if first_relay.wantList is True:
first_relay.list(nocheck=True) first_relay.list(nocheck=True)
debug("Asking for a list for %s after final relay %i connected" % (self.net, self.num)) debug("recheckList() asking for a list for {self.net} after final relay {self.num} connected")
# name = self.net + "1" # name = self.net + "1"
# if self.num == 1: # Only one instance should do a list # if self.num == 1: # Only one instance should do a list
if helpers.is_first_relay(self.net, self.num): if helpers.is_first_relay(self.net, self.num):
debug(f"recheckList() we are the first relay for {self.net} ({self.num})")
if self.chanlimit: if self.chanlimit:
if allRelays: if allRelays:
self.list() self.list()
debug(f"recheckList() requested a list for {self.net} from {self.num}")
else: else:
self.wantList = True self.wantList = True
else: else:
debug("Aborting LIST due to bad chanlimit") debug("recheckList() aborting LIST due to bad chanlimit")
self.checkChannels() self.checkChannels()
def seed_chanlimit(self, chanlimit): def seed_chanlimit(self, chanlimit):