Checkpoint before follow-up message - #2684
Conversation
Co-authored-by: amirbiron <amirbiron@gmail.com>
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
🧯 Dangerous deletes guard reportPolicy: see .cursorrules — dangerous deletions are blocked unless wrapped safely. Summary:
Flagged findings (file:line:snippet): Excluded matches (by path pattern) |
⏱️ Performance report(No performance test durations collected. Mark tests with |
📖 Documentation PreviewThe documentation has been built successfully!
To view locally:
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Uh oh!
There was an error while loading. Please reload this page.
Prevent cached shared themes list from being mutated by callers by returning copies on both cache hits and misses.
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Use local snapshots for cache reads and a cache version counter to prevent invalidate_cache() from being overwritten by concurrent refreshes.
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Uh oh!
There was an error while loading. Please reload this page.
מה שופץ כדי להאיץ את /api/themes/list
ב־services/shared_theme_service.py הוספתי cache בזיכרון ל־SharedThemeService.get_all_active() עם TTL של 5 דקות, כדי שלא תהיה שאילתת Mongo בכל בקשה.
בנוסף:
איפוס cache אחרי פעולות שינוי (create/update/delete) באמצעות invalidate_cache().
המרת _id ל־str כדי למנוע בעיות סריאליזציה אם זה ObjectId.
ensure_indexes() ליצירת אינדקס compound (best-effort, לא שובר טסטים אם לא נתמך).
הקוד המרכזי (כולל cache + אינדקסים + invalidate):
/workspace/services/shared_theme_service.py
Lines 51-192
Note
Speeds up fetching shared themes and reduces DB load by caching and indexing the active themes list.
SharedThemeService.get_all_active()with versioned invalidation to avoid races and returns defensive copies_idtostrfor JSON safety inget_all_activeinvalidate_cache()aftercreate,update, anddeleteensure_indexes()to create a compound index onshared_themes(is_active,order,created_at) best‑efforttimedelta; no external API changesFiles:
services/shared_theme_service.pyWritten by Cursor Bugbot for commit 3317c07. This will update automatically on new commits. Configure here.