Skip to content

Conversation

@maffettone
Copy link
Contributor

@maffettone maffettone commented Mar 12, 2025

Closes #922

This extends the purge_expired call to accept an optional refresh_token_max_age. The PURGE_INTERVAL was elevated to the module level to enable testing. Testing exposed some silent issue with the previous purge function that were solved by two changes:

  1. Doing UTC time comparison filters differently between postgres and sqlite.
  2. Adding a .unique() call to the result following the query to handle any eager loading of joined tables.

The tests were run first against the original purge_expired function with these modifications, before updating the function.

Since all testing was done locally against SQLite, I expect this will need to be tested against a PostgresSQL auth database before approval and merge (not sure if this is in the CI).

Checklist

  • Add a Changelog entry
  • Add the ticket number which this PR closes to the comment section

- add: elevate PURGE_INTERVAL to global scope
- change: purge_expired to have dialect dependent behavior
- fix: adds unique() to deal with eager loading of joined relationships (Principal/Session)
@maffettone maffettone requested a review from danielballan March 12, 2025 23:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Purge Sessions that are too stale to refresh

1 participant