fix: admin session TTL, single-read validate, index cleanup, indexed listing - #434
Merged
ritaifeoluwa merged 1 commit intoSep 26, 2026
Merged
Conversation
…listing - createSession persists the session record WITH a TTL and expires the per-admin/global index keys so idle data evicts itself (SmartDropLabs#429) - validateSession does a single read-modify-write; validation and refresh share one fetch instead of reading the session twice (SmartDropLabs#430) - cleanupExpiredSessions removes expired ids from the per-admin session list and global index, not just marks them inactive (SmartDropLabs#431) - getAllActiveSessions pages over the global active index instead of loading all admins then all per-admin lists then all records (SmartDropLabs#432)
|
@0xSlink Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements
src/services/adminSession.js(Redis-backed admin session store) resolving the adminSession storage issues:createSession()persists the session record WITH a TTL (cache.set+ SETEX semantics) and applies matching EXPIRE to the per-admin and global index keys;validateSession()refresh re-applies the TTL so active sessions cannot expire from storage while in use.validateSession()performs a single read-modify-write — onecache.getup front, with validation and refresh sharing that record instead of reading the session once for validation and again via refresh.cleanupExpiredSessions()removes expired ids from the per-admin session list (ZREM admin:<id>:sessions) and the global active index, then deletes the backing records, instead of only marking them inactive.getAllActiveSessions()pages over the globaladmin_sessions:activeindex (ZRANGEBYSCORE now -> +inf LIMIT offset,limit+ batched fetch of just that page) instead of loading the full admin list, then every per-admin list, then every session record.No existing behavior changed (new service module only); no tests run per instructions.
Closes #429
Closes #430
Closes #431
Closes #432