Repository navigation
Add explicit opt-in stale-session cleanup - #55
Merged
Merged
Conversation
dblock
force-pushed
the
dblock/stale-sessions
branch
from
October 17, 2026 11:27
2a91f00 to
acc42dd
Compare
Closed
Danger ReportNo issues found. |
Require a Time cutoff and delete only sessions whose updated_at precedes it, returning the count from the configured collection. Normalize timezone-aware cutoffs to native UTC Time for BSON without mutating the caller. Leave retention policy and scheduling to the caller; install no defaults, background jobs, or TTL indexes. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
dblock
force-pushed
the
dblock/stale-sessions
branch
from
October 17, 2026 11:40
acc42dd to
a789ac7
Compare
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.
Fixes #37. Thanks to @jbarrantes for the original stale-session retention request.
Add MongoidStore.delete_stale_sessions(before: cutoff) and MongoStore.delete_stale_sessions(before: cutoff) through their shared base class. Require an explicit Time cutoff, bulk-delete only records whose updated_at is strictly earlier, and return the deleted count. Preserve boundary, active, missing-date and null-date records. Use the configured collection, accept UTC offsets and Rails time zones, normalize to a native UTC Time for BSON without mutating the caller, and propagate database failures. No implicit maximum age, automatic cleanup, TTL index, or change to normal request handling.
Document scheduling, deletion semantics, callback bypass, and the distinction between last-save timestamps and inactivity-based authentication expiry. Cover both adapters, repeated/empty cleanup, invalid cutoffs, custom collections, timezone handling and database-error propagation.
Both complete adapter suites pass locally on Rails 7.2 (55 Mongo / 46 Mongoid examples), using #53’s test harness against this branch’s library and specs. Branch is based independently on main. Merge #53 first to exercise the expanded matrix.
Prepared by an AI on behalf of @dblock.