Move user metadata info into redis

This commit is contained in:
2018-08-27 20:42:49 +01:00
parent b31b5d40e8
commit 36105c7e9a
7 changed files with 215 additions and 72 deletions

View File

@@ -1,5 +1,6 @@
import main
import modules.counters as count
import modules.userinfo as userinfo
class Stats:
def __init__(self, register):
@@ -13,8 +14,7 @@ class Stats:
numWhoEntries = 0
for i in main.IRCPool.keys():
numChannels += len(main.IRCPool[i].channels)
for i in main.wholist.keys():
numWhoEntries += len(main.wholist[i].keys())
numWhoEntries += userinfo.getNumTotalWhoEntries()
stats.append("Servers: %s" % len(main.pool.keys()))
stats.append("Online servers: %s" % len(main.IRCPool.keys()))
stats.append("Channels: %s" % numChannels)
@@ -34,20 +34,11 @@ class Stats:
numChannels = 0
numWhoEntries = 0
failures = 0
if spl[1] in main.IRCPool.keys():
numChannels += len(main.IRCPool[spl[1]].channels)
else:
failure("Name does not exist: %s" % spl[1])
failures += 1
if spl[1] in main.wholist.keys():
numWhoEntries += len(main.wholist[spl[1]].keys())
else:
failure("Who entry does not exist: %s" % spl[1])
failures += 1
if failures == 2:
failure("No information found, aborting")
return
numWhoEntries += userinfo.getNumWhoEntries(spl[1])
stats.append("Channels: %s" % numChannels)
stats.append("User records: %s" % numWhoEntries)
counterEvents = count.getEvents(spl[1])