mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2024-12-25 14:37:02 +01:00
Force ttl
This commit is contained in:
parent
57d23e8d68
commit
e1a3dd3556
@ -83,13 +83,15 @@ class RedisQueue:
|
|||||||
break
|
break
|
||||||
return (unformatted_item, formatted_item)
|
return (unformatted_item, formatted_item)
|
||||||
|
|
||||||
async def enforce_expiring_key(self, key):
|
async def enforce_expiring_key(self, key, ttloverride=None):
|
||||||
ttl = await self.connection.ttl(key)
|
ttl = await self.connection.ttl(key)
|
||||||
newttl = 0
|
newttl = 0
|
||||||
if ttl == -1:
|
if ttl == -1:
|
||||||
newttl = 60 * 5 # 5 minutes
|
newttl = 60 * 5 # 5 minutes
|
||||||
if ttl >= 0:
|
if ttl >= 0:
|
||||||
newttl = ttl
|
newttl = ttl
|
||||||
|
if ttloverride:
|
||||||
|
newttl = ttloverride
|
||||||
await self.connection.expire(key, newttl)
|
await self.connection.expire(key, newttl)
|
||||||
|
|
||||||
async def on_get_channel_messages(self, key, params):
|
async def on_get_channel_messages(self, key, params):
|
||||||
@ -134,7 +136,8 @@ class RedisQueue:
|
|||||||
if not member:
|
if not member:
|
||||||
members = await guild.query_members(user_ids=[int(params["user_id"])], cache=True)
|
members = await guild.query_members(user_ids=[int(params["user_id"])], cache=True)
|
||||||
if not len(members):
|
if not len(members):
|
||||||
self.remove_member(member)
|
await self.connection.set(key, "")
|
||||||
|
await self.enforce_expiring_key(key, 15)
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
member = members[0]
|
member = members[0]
|
||||||
|
Loading…
Reference in New Issue
Block a user