Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
Greptile SummaryIntroduces a DSR cache store on top of the Key changes:
Confidence Score: 3/5
Important Files Changed
Last reviewed commit: 48c0bb7 |
| keys = self._manager.get_keys_by_index(index_prefix) | ||
| if keys: | ||
| return keys | ||
| legacy_keys = list(self._redis.scan_iter(match=f"*{dsr_id}*", count=500)) |
There was a problem hiding this comment.
SCAN pattern *{dsr_id}* could match unintended keys. If a DSR ID like "abc" exists, keys containing "abc" anywhere (e.g., dsr:xyz-abc-123:field or some-other-key-abc) will be matched. Use anchored pattern like dsr:{dsr_id}:* for new keys, and handle legacy separately if needed.
There was a problem hiding this comment.
This is by design to keep consistency with the existing way keys are globbed by the DSR clearing and not break existing data that may be in Redis until everything moves over to the new index method
| complete cleanup in mixed-key scenarios. | ||
| """ | ||
| # Use SCAN to find ALL keys (indexed + legacy) | ||
| all_keys_via_scan = list(self._redis.scan_iter(match=f"*{dsr_id}*", count=500)) |
There was a problem hiding this comment.
Same SCAN pattern issue here. *{dsr_id}* could delete unrelated keys that happen to contain the DSR ID substring. Use dsr:{dsr_id}:* for new keys and handle legacy keys with separate patterns.
Additional Comments (1)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time! |
| from contextlib import contextmanager | ||
| from typing import Iterator |
There was a problem hiding this comment.
These don't seem to be used (yet) - do we need them imported here?
JadeCara
left a comment
There was a problem hiding this comment.
Overall looks good! I am excited for this change :)
Deserialize keys to strings when in `get_keys_by_index` - preferring deliberate conversion over `decode_responses` Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
90adcf8 to
48c0bb7
Compare
Codecov Report❌ Patch coverage is ❌ Your patch check has failed because the patch coverage (0.00%) is below the target coverage (100.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## johnewart/ENG-740/0-redis-cache-manager #7463 +/- ##
===========================================================================
- Coverage 85.53% 84.28% -1.25%
===========================================================================
Files 564 564
Lines 37812 37910 +98
Branches 4399 4403 +4
===========================================================================
- Hits 32341 31951 -390
- Misses 4479 4956 +477
- Partials 992 1003 +11 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Ticket ENG-2758
Description Of Changes
Adds a DSR cache store on top of the indexing RedisCacheManager that has well-known operations to avoid "arbitrary" key names and ensures consistency. Does not integrate the new store with any APIs or other code, this is just the DSR cache itself.
Code Changes
Steps to Confirm
No manual steps, has tests.
Pre-Merge Checklist
CHANGELOG.mdupdatedmaindowngrade()migration is correct and works