carmine
carmine copied to clipboard
Ring middleware: expiration is not reset when session key is read
Steps to reproduce:
- Create a project using ring and this carmine ring session middleware
- Configure the carmine store to have a session expiration of 10 seconds
- Login and verify in Redis monitor that the session is created
- Wait five seconds and refresh the browser; in Redis monitor you can see that the keys is read
- Wait six seconds and refresh the browser
Expected behavior: session is still active because only six seconds have passed after the last request
Actual behavior: session has expired because more than 10 seconds have passed after the session was created.
See PR #254.
@svdo Hi Stefan, thanks for this!
The current behaviour is intentional though, and documented here.
There's cases where one might want to refresh session on write only, and cases where one might want to refresh on reads too.
Your proposed change would break the documented behaviour, so isn't an option.
But would be open to see a PR that extends carmine-store
to add a new :extend-on-read?
option (default false).
Hope that makes sense!
Cheers :-)
Thanks for your quick response @ptaoussanis! Thanks for pointing out the backward compatibility issue, I agree that this should be behind an option. I'll modify the PR accordingly.
Do you mind about the inclusion of deps.edn
that I did?
Do you mind about the inclusion of deps.edn that I did?
Would prefer that be a separate PR, thanks!
@ptaoussanis I have created as new pull request. Please let me know if this needs any more work!
PR merged, closing. Thanks again!