Add allRelaysActive output to network info
This commit is contained in:
parent
feecf48b9b
commit
39059084ef
|
@ -187,6 +187,7 @@ class API(object):
|
||||||
networks = {}
|
networks = {}
|
||||||
for net in main.network.keys():
|
for net in main.network.keys():
|
||||||
networks[net] = {
|
networks[net] = {
|
||||||
|
"active": chankeep.allRelaysActive(net),
|
||||||
"relays": len(main.network[net].relays),
|
"relays": len(main.network[net].relays),
|
||||||
"channels": userinfo.getTotalChanNum(net),
|
"channels": userinfo.getTotalChanNum(net),
|
||||||
"records": userinfo.getNumWhoEntries(net),
|
"records": userinfo.getNumWhoEntries(net),
|
||||||
|
|
|
@ -489,7 +489,7 @@ class IRCBot(IRCClient):
|
||||||
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("recheckList() asking for a list for {self.net} after final relay {self.num} connected")
|
debug(f"recheckList() asking for a list for {self.net} after final relay {self.num} connected")
|
||||||
else:
|
else:
|
||||||
debug(f"recheckList() first relay wantList is False for {self.net} ({first_relay.num})")
|
debug(f"recheckList() first relay wantList is False for {self.net} ({first_relay.num})")
|
||||||
# name = self.net + "1"
|
# name = self.net + "1"
|
||||||
|
|
|
@ -62,6 +62,18 @@ def getActiveRelays(net):
|
||||||
return activeRelays
|
return activeRelays
|
||||||
|
|
||||||
|
|
||||||
|
def relayIsActive(net, num):
|
||||||
|
"""
|
||||||
|
Check if a relay is active.
|
||||||
|
:param net: network
|
||||||
|
:param num: relay number
|
||||||
|
:rtype: bool
|
||||||
|
:return: True if relay is active, False otherwise
|
||||||
|
"""
|
||||||
|
activeRelays = getActiveRelays(net)
|
||||||
|
return num in activeRelays
|
||||||
|
|
||||||
|
|
||||||
def allRelaysActive(net):
|
def allRelaysActive(net):
|
||||||
"""
|
"""
|
||||||
Check if all enabled relays are active and authenticated.
|
Check if all enabled relays are active and authenticated.
|
||||||
|
|
Loading…
Reference in New Issue