mirror of https://gitlab.com/litecord/litecord.git
storage: do unavailable guild object rewrite earlier on
prevent unecessary db calls as soon as the guild is determined to be unavailable
This commit is contained in:
parent
ea9b06182d
commit
a2e55d80e8
|
|
@ -180,6 +180,18 @@ class Storage:
|
|||
|
||||
drow = dict(row)
|
||||
|
||||
# a guild's unavailable state is kept in memory, and we remove every
|
||||
# other guild related field when its unavailable.
|
||||
drow['unavailable'] = self.app.guild_store.get(
|
||||
guild_id, 'unavailable', False)
|
||||
|
||||
if drow['unavailable']:
|
||||
drow = {
|
||||
'id': drow['id'],
|
||||
'unavailable': True
|
||||
}
|
||||
|
||||
# guild.owner is dependant of the user doing the get_guild call.
|
||||
if user_id:
|
||||
drow['owner'] = drow['owner_id'] == str(user_id)
|
||||
|
||||
|
|
@ -192,17 +204,6 @@ class Storage:
|
|||
drow['max_presences'] = 1000
|
||||
drow['max_members'] = 1000
|
||||
|
||||
# a guild's unavailable state is kept in memory, and we remove every
|
||||
# other guild related field when its unavailable.
|
||||
drow['unavailable'] = self.app.guild_store.get(
|
||||
guild_id, 'unavailable', False)
|
||||
|
||||
if drow['unavailable']:
|
||||
drow = {
|
||||
'id': drow['id'],
|
||||
'unavailable': True
|
||||
}
|
||||
|
||||
return drow
|
||||
|
||||
async def _member_basic(self, guild_id: int, member_id: int):
|
||||
|
|
|
|||
Loading…
Reference in New Issue