#42413 에서 토픽의 캐시 무효화 로직이 재설계되었습니다.
그러나 Discourse.cache.keys("page_not_found_topics:*").each { |key| Discourse.cache.redis.del(key) }는 모든 Redis 키를 순회하므로 성능 문제를 일으킬 수 있으며, 키의 수가 많을 경우 타임아웃이 발생할 수 있습니다.
Redis DB가 큰 사이트에서는 사용자가 토픽을 제한된 카테고리로 이동할 때 500 오류를 경험할 수 있습니다.
이 커밋은 순회 범위를 전체 Redis보다 훨씬 작은 Discourse.cache.normalize_key("page_not_found_topics:#{locale}")로 제한하고, scan_each의 실행을 방지하기 위해 테스트를 추가합니다.
main ← small-lovely-cat:fix-perf-traversing-redis-keys
merged 12:08PM - 09 Aug 26 UTC
In #42413 , cache invalidation logic of topic is redesigned.
However, `Discou… rse.cache.keys("page_not_found_topics:*").each { |key| Discourse.cache.redis.del(key) }` will traverse all of the redis keys, causing performance issues, and may timeout if there are large amount of keys.
For a site with a large Redis DB, users may encounter 500 error when they move a topic to a restricted category.
<img width="240" height="211" alt="image" src="https://github.com/user-attachments/assets/e16e87d0-2c1e-437e-99bf-521c5e4774a1" />
This commit restrict the traverse scope to `Discourse.cache.normalize_key("page_not_found_topics:#{locale}")`, which is far smaller than the whole redis, also add a test to avoid the execution of `scan_each`.
2개의 좋아요
sam
(Sam Saffron)
8월 10, 2026, 1:51오전
2
정말 감사합니다, @zogstrip님이 병합했어요!
1개의 좋아요
Falco
(Falco)
에 닫힘
8월 10, 2026, 11:00오전
3
이 주제는 13시간 후 자동으로 닫혔습니다. 더 이상 새 답글을 작성할 수 없습니다.