ComputerScienceHouse / ComputerScienceHouse/packet

Cache RIT Images better

未关闭
#292 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
good first issue javascript python
主要语言
Python
星标
25
派生
33
PR 合并指标
30 天内没有已合并 PR

描述

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.

贡献指南

这个仓库没有索引到贡献指南

调研方向

从 packet/context_processors.py 的第 58-70 行开始,检查 RIT 图像查找周围对 functools.lru_cache 的使用。删除缓存作为最小修复,然后验证无需重启 pods 即可显示更新后的图像;lazy frontend loading 是 issue 提到的一种可选替代方案,但不是必需的。

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
backend, performance
Issue 类型
缺陷
难度
2/5
预计耗时
1-3 小时
活跃度
停滞
描述清晰度
基本清楚
新手友好度
55/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。