-
-
Notifications
You must be signed in to change notification settings - Fork 16
perf: parallelize cache invalidation for better performance #815
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
📝 WalkthroughWalkthroughAdded an asynchronous helper Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant API as UserEndpoint
participant Inval as InvalidationHelper
participant Cache as CacheStore
Client->>API: perform user mutation (e.g. ban, edit)
API->>Inval: call invalidate_user_related_caches(user_id)
Inval->>Cache: invalidate user-specific cache (async)
Inval->>Cache: invalidate users-list cache (async)
Note right of Inval: both invalidations run concurrently via asyncio.gather
Cache-->>Inval: acknowledgements
Inval-->>API: completion
API-->>Client: mutation response
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
🔇 Additional comments (5)
✏️ Tip: You can disable this entire section by setting Comment |
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: See your quality gate settings Change summary preferences |
…idation - Add CacheNamespaces constants reference to avoid hardcoded strings - Update examples to show invalidate_user_related_caches() for parallel invalidation instead of sequential calls - Add tip recommending use of namespace constants - Update all code examples to use best practices Relates to PR #814 (namespace constants) and PR #815 (parallel invalidation)
Summary
invalidate_user_related_caches()helper that usesasyncio.gather()to invalidate caches in parallelRefers to SECURITY-REVIEW.md issue
#33Summary by CodeRabbit
Performance
Refactor
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.