AscendingCreations / AxumSession

Axum Session Management Libraries that use Sqlx
MIT License
136 stars 28 forks source link

Redis session stored non transactionally #70

Closed Falmarri closed 9 months ago

Falmarri commented 9 months ago

https://github.com/AscendingCreations/AxumSession/blob/093eeb388a5f0fc5142f1f517c3f2c6d260206c5/src/databases/redis_pool.rs#L55

This doesn't use a redis transaction, so it's possible to leave a session without a TTL, correct? Shouldn't this use a transaction?

genusistimelord commented 9 months ago

yeah if we want to ensure they execute one after the other then making them transactional would help, but the expireat command should not fail regardless if the set was successful. however, to ensure the set data is updated with an expire at the same time making it a transaction is not hard. So simply by setting the pipeline as atomic makes it a transaction. I have done so in https://github.com/AscendingCreations/AxumSession/commit/98f81f0c62565ed972d4c35d37b6ee4fb9d19815

So that commit should fix the issue and enforce those commands to run together rather than separately.