[PR #4904] [MERGED] refactor: shorten expires logic with filters and sorts #22549

Closed
opened 2026-04-15 21:07:34 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/4904
Author: @dvanmali
Created: 9/25/2025
Status: Merged
Merged: 9/25/2025
Merged by: @himself65

Base: canaryHead: internalAdapter


📝 Commits (3)

  • 47bf21c refactor: shorten expires logic with filters and sorts
  • fb546d8 fix: cubic-dev-ai suggestion fixes
  • dd5e5c4 fix: test expiration requires buffer

📊 Changes

2 files changed (+24 additions, -30 deletions)

View changed files

📝 packages/better-auth/src/db/internal-adapter.test.ts (+5 -1)
📝 packages/better-auth/src/db/internal-adapter.ts (+19 -29)

📄 Description

Addresses comments on PR #3836


Summary by cubic

Shortened active-session expiration handling in internalAdapter. Improves clarity and correctness of TTL updates and stored session lists.

  • Refactors
    • Replaced manual loops with Array.filter/sort and used at(-1) to get the furthest expiration for TTL.
    • Persist only non-expired sessions; store sorted list on add and delete the key when none remain.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/4904 **Author:** [@dvanmali](https://github.com/dvanmali) **Created:** 9/25/2025 **Status:** ✅ Merged **Merged:** 9/25/2025 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `internalAdapter` --- ### 📝 Commits (3) - [`47bf21c`](https://github.com/better-auth/better-auth/commit/47bf21cfec79ec52531f6a76e420f88c364613ea) refactor: shorten expires logic with filters and sorts - [`fb546d8`](https://github.com/better-auth/better-auth/commit/fb546d8a878f6ded4e5d1939d240618e2529305f) fix: cubic-dev-ai suggestion fixes - [`dd5e5c4`](https://github.com/better-auth/better-auth/commit/dd5e5c498b35db8ea0f4ee9c7f94c85843ed6a0d) fix: test expiration requires buffer ### 📊 Changes **2 files changed** (+24 additions, -30 deletions) <details> <summary>View changed files</summary> 📝 `packages/better-auth/src/db/internal-adapter.test.ts` (+5 -1) 📝 `packages/better-auth/src/db/internal-adapter.ts` (+19 -29) </details> ### 📄 Description Addresses comments on PR #3836 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Shortened active-session expiration handling in internalAdapter. Improves clarity and correctness of TTL updates and stored session lists. - **Refactors** - Replaced manual loops with Array.filter/sort and used at(-1) to get the furthest expiration for TTL. - Persist only non-expired sessions; store sorted list on add and delete the key when none remain. <!-- End of auto-generated description by cubic. --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-15 21:07:34 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#22549