Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve flask session usage #102

Open
podliashanyk opened this issue May 29, 2024 · 2 comments
Open

Improve flask session usage #102

podliashanyk opened this issue May 29, 2024 · 2 comments

Comments

@podliashanyk
Copy link
Contributor

podliashanyk commented May 29, 2024

Make sure that:

  • Cookie data is cleaned up frequently enough. Especially relevant after storing event_ids in session in Table refresh with ntie #87. Running Howitz for a long time with lots og events being updated could increase cookie size up to its limit.
  • Reuse cookie (remember me f.e.) where possible. So that user is not logged out for as long time as possible until manual logout.
  • ...
@hmpf
Copy link
Contributor

hmpf commented Jun 20, 2024

On testing another branch today I got the following error:

/../.virtualenvs/howitz/lib/python3.10/site-packages/werkzeug/sansio/response.py:261: U
serWarning: The 'session' cookie is too large: the value was 4159 bytes but the header requi
red 26 extra bytes. The final size was 4185 bytes but the limit is 4093 bytes. Browsers may 
silently ignore cookies larger than this. 
 dump_cookie(

While the sorted list of event ids and what is selected is session specific, the list of known events is not and can be cached.

@hmpf
Copy link
Contributor

hmpf commented Jun 20, 2024

Given a session id, we can store sessions in the cache too, just have to remember to delete it on logout.

See https://flask-session.readthedocs.io/en/latest/usage.html#using-cachelib-as-a-session-backend

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants