[RFE?] Use monotonic clock for expiry checks for in-memory stores #85
-
This is a bit of a specific use-case so probably not fit for RFE. One of the issues that crept in recently is that if there's no external connection set up, NTP likely won't be working. At this point, thanks to the cookie only setting max-age and not an absolute expires timestamp, users can log in and do what they need (this was a problem with the old axum-sessions that was using expires with a date in the past... chrome apparently ignores deadlines in 1970 but firefox would just forget the cookie immediately and the login page never worked...) It'd be great if sessions could use not OffsetDateTime::now_utc, but instead something like std::time::Instant and relative time comparisons. This is far from obvious because this obviously cannot work with DB stores -- monotonic time makes no sense in face of application restart or system reboot. Using a monotonic time internally would mean converting it to real time every time at store boundaries, which probably isn't something you'd want. At this point I think it'd be easier to just go and make my own variant of MemoryStore that ignores What do you think? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Interesting use case. Taking a step back, it probably is not clear enough that we fully intend users to write their own stores and the ones included here are largely just for convenience. So I do think a custom store could be appropriate here. It's worth pointing out that internally |
Beta Was this translation helpful? Give feedback.
Interesting use case.
Taking a step back, it probably is not clear enough that we fully intend users to write their own stores and the ones included here are largely just for convenience.
So I do think a custom store could be appropriate here.
It's worth pointing out that internally
OffsetDateTime
is used throughout. This could lead to surprising behavior. For instance, max age will still be calculated with UTC now.