ComputerScienceHouse / ComputerScienceHouse/packet

Cache RIT Images better

Open
#292 0 comments 0 reactions 0 assignees View on GitHub
good first issue javascript python
Dominant language
Python
Stars
25
Forks
33
PR merge metrics
No merged PRs in 30d

Description

This is a bad cache
https://github.com/ComputerScienceHouse/packet/blob/f61cd2b5b616e3b7f35fad95b515313ea2d50bcb/packet/context_processors.py#L58-L70

It caches the first call to this function for any given username (up to 256 of them) via [`functools.lru_cache`](https://docs.python.org/3/library/functools.html#functools.lru_cache), which is bad, because it kinda defeats the point of gravatar.

We _could_ do some form of caching, but probably shouldn't. Loading these images lazily in the frontend would probably be much better.

At the very least, please remove the cache so we can stop kicking the pods to have photos update.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in packet/context_processors.py at lines 58-70 and inspect the functools.lru_cache usage around the RIT image lookup. Remove the cache as the minimum fix, then verify that updated images can appear without restarting the pods; lazy frontend loading is a possible alternative mentioned by the issue but is not required.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, performance
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.