fix: Improve launch caching systems.
This commit is contained in:
@@ -61,9 +61,10 @@ async def preload_studying_members(client):
|
||||
"""
|
||||
userids = list(set(member.id for guild in client.guilds for ch in guild.voice_channels for member in ch.members))
|
||||
if userids:
|
||||
rows = client.data.lions.fetch_rows_where(userid=userids)
|
||||
users = client.data.user_config.fetch_rows_where(userid=userids)
|
||||
members = client.data.lions.fetch_rows_where(userid=userids)
|
||||
client.log(
|
||||
"Preloaded member data for {} members.".format(len(rows)),
|
||||
"Preloaded data for {} user with {} members.".format(len(users), len(members)),
|
||||
context="CORE_LOADING"
|
||||
)
|
||||
|
||||
|
||||
@@ -56,10 +56,10 @@ class video_channels(settings.ChannelList, settings.ListData, settings.Setting):
|
||||
if any(channel.members for channel in guild.voice_channels)
|
||||
]
|
||||
if active_guildids:
|
||||
cache = {guildid: [] for guildid in active_guildids}
|
||||
rows = cls._table_interface.select_where(
|
||||
guildid=active_guildids
|
||||
)
|
||||
cache = defaultdict(list)
|
||||
for row in rows:
|
||||
cache[row['guildid']].append(row['channelid'])
|
||||
cls._cache.update(cache)
|
||||
|
||||
Reference in New Issue
Block a user