Skip to content

Commit

Permalink
chore: add TTL from last access to paginators
Browse files Browse the repository at this point in the history
  • Loading branch information
Skelmis committed Feb 4, 2024
1 parent ba699cc commit 3de696f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
8 changes: 8 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,26 @@ aiodns==3.0.0
aiohttp==3.8.1
aiosignal==1.2.0
alaric==1.2.0
anyio==4.2.0
async-timeout==4.0.2
attrs==21.4.0
Bot-Base==1.7.1
Brotli==1.0.9
causar==0.2.0
cchardet==2.1.7
certifi==2023.11.17
cffi==1.15.0
charset-normalizer==2.0.12
disnake @ git+https://github.com/suggestionsbot/disnake.git@22a572afd139144c0e2de49c7692a73ab74d8a3d
disnake-ext-components @ git+https://github.com/suggestionsbot/disnake-ext-components.git@91689ed74ffee73f631453a39e548af9b824826d
dnspython==2.2.1
exceptiongroup==1.2.0
frozenlist==1.3.0
function-cooldowns==1.3.1
graphviz==0.20.1
h11==0.14.0
httpcore==1.0.2
httpx==0.26.0
humanize==4.2.0
idna==3.3
iniconfig==1.1.1
Expand All @@ -38,6 +44,8 @@ pytest==7.1.3
pytest-asyncio==0.19.0
python-dotenv==0.20.0
sentinels==1.0.0
skelmis-commons==1.1.0
sniffio==1.3.0
tomli==2.0.1
typing_extensions==4.3.0
websockets==10.4
Expand Down
7 changes: 4 additions & 3 deletions suggestions/cogs/suggestion_queue_cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
from alaric.comparison import EQ
from alaric.logical import AND
from alaric.projections import Projection, SHOW
from bot_base import NonExistentEntry
from bot_base.caches import TimedCache
from commons.caching import NonExistentEntry, TimedCache
from disnake import Guild
from disnake.ext import commands, components

Expand All @@ -35,7 +34,9 @@ def __init__(self, bot):
self.state = self.bot.state
self.queued_suggestions_db: Document = self.bot.db.queued_suggestions
self.paginator_objects: TimedCache = TimedCache(
global_ttl=timedelta(minutes=15), lazy_eviction=False
global_ttl=timedelta(minutes=15),
lazy_eviction=False,
ttl_from_last_access=True,
)

async def get_paginator_for(
Expand Down

0 comments on commit 3de696f

Please sign in to comment.