BA
Better Authโ€ข2mo ago
varundeva

Why few keys in redis has no TTL?

Hey im noticing many keys are there in redis which has no TTL, so it stays forever, session information will be expiry after 30 days, Im using secondary database as redis by passing secondaryStorage: { get: async (key) => { const value = await redis.get(key); return value ? value : null; }, set: async (key, value, ttl) => { if (ttl) await redis.set(key, value, ttl); else await redis.set(key, value); }, delete: async (key) => { await redis.delete(key); }, }, to auth Just need to understand how to add ttl to this? and is it bug? because of this redis is getting huge amout of data, even when this is used? ๐Ÿ˜•
No description
9 Replies
varundeva
varundevaOPโ€ข2mo ago
@admin please check this Because I'm using secondary database to get rid of the load for primary database mongodb @bekacru
bekacru
bekacruโ€ข2mo ago
looking into this
varundeva
varundevaOPโ€ข2mo ago
Thanks @bekacru In code itself I checked a lot Not getting from where these info pushing to secondary database Please let me know if any additional information needed
varundeva
varundevaOPโ€ข4w ago
Hey https://github.com/better-auth/better-auth/issues/4034 I have added more information here, but ticket closed, ๐Ÿ™
GitHub
Why few keys in redis has no TTL? ยท Issue #4034 ยท better-auth/bet...
Is this suited for github? Yes, this is suited for github To Reproduce Hey im noticing many keys are there in redis which has no TTL, so it stays forever, session information will be expiry after 3...
varundeva
varundevaOPโ€ข4w ago
Hey, I have debugged and found that it does not have a TTL Here is a screenshot while setting to Redis, a few don't have TTL, Mainly, I can see that the keys are api endpoint names, My Redis function to set is working fine,
No description
No description
No description
No description
Ping
Pingโ€ข4w ago
I just re-opened it, sorry for the inconvenience.
varundeva
varundevaOPโ€ข4w ago
Yes, i checked it today again, its happening for the apis of better-auth if i call any api it pushes one key value to redis, which is not having any TTL, for each user its pushing key value with their IP, so redis is consuming lot of memory, User's Session data is having TTL, crosschecked it.
Ping
Pingโ€ข4w ago
Yeah, it's an active issue I tried to look for this same issue on Github to see if there was a duplicate but couldn't find any, I suppose I've seen this issue before on Discord I do think it's a big issue so I'll make sure it's a higher priority
varundeva
varundevaOPโ€ข4w ago
Oh ok.. Carry On. not a hurry, hope will fix this in future releases, i though im using ratelimit thats why each api is storing there, but im not using any ratelimit

Did you find this page helpful?