Files
offline-db/patch_badge_system4.py
6e2f5d30e2 ⚡ Bolt: [performance improvement] fix N+1 query in check_badges loop (#347)
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
Co-authored-by: Senpai-YoloBot <41898282+github-actions[bot]@users.noreply.github.com>
2026-04-19 21:10:44 +00:00

15 lines
564 B
Python

import re
with open('users/badge_system.py', 'r') as f:
content = f.read()
# Make sure we're caching across the strategy array, by storing the results on the `cache` dict argument passed to the checks.
# Wait, actually let me inspect what's happening. The cache dict is actually `strategy_cache = {}` inside `check_badges`
# which is passed to *all* strategies. So putting things in `cache` should persist across the entire `check_badges` loop.
content = re.sub(
r" if cache is not None:",
r""" if cache is not None:""",
content
)