RasmusKard / what.watch

Get a randomized movie or tv show suggestion based on your chosen parameters.
https://what.watch/
0 stars 0 forks source link

Variables getting cleared on Pythonanywhere. Working fine when running locally. #17

Closed RasmusKard closed 1 year ago

RasmusKard commented 1 year ago

Need to cache?

RasmusKard commented 1 year ago

Issue is caused by re-roll, could deprecate the feature but the performance hit would be significant when re-rolling. The filtered pandas dataframe is at times being cleared out between requests, need to figure out a way to make it persistent while the user is on the site.

Potential ideas:

  1. Save filtered dataframe in the server by UID. Deletion based on time. When user clicks reroll files are checked for a dataframe that matches the user's UID, if it isn't found a new dataframe is created based on the filters stored in the user's session data.
  2. Cache the dataframe
  3. https://stackoverflow.com/a/69375619
RasmusKard commented 1 year ago

Attempting to use flask_session library for server-side session file storage, having issues with sessions sharing files.

RasmusKard commented 1 year ago

Seems to be working. Needs some further testing and deletion of redundant session files.

8bb4dafcaad9d9ddc18f92802bb5b88387ad1e87

RasmusKard commented 1 year ago

Using flask_session to store files was too slow. Ended up using pandas to store the data in a parquet file.

Parquet files are being deleted by file creation age or if the directory reaches the max allowed amount of files.

61b73d1080f4b753decadb594462a05a05dd7933