-
Notifications
You must be signed in to change notification settings - Fork 3.2k
fix: FIT-1054: Ensure redis cache is used if available for all FSM operations which use cache #8896
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
…erations which use cache
✅ Deploy Preview for heartex-docs canceled.
|
✅ Deploy Preview for label-studio-playground ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for label-studio-storybook ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for label-studio-docs-new-theme canceled.
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #8896 +/- ##
============================================
+ Coverage 66.10% 81.03% +14.92%
============================================
Files 820 259 -561
Lines 64416 23561 -40855
Branches 11041 0 -11041
============================================
- Hits 42581 19092 -23489
+ Misses 21831 4469 -17362
+ Partials 4 0 -4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This pull request updates the caching mechanism used by the FSM (Finite State Machine) state management in
label_studio/fsm/state_manager.py. The main goal is to ensure that FSM operations use the correct cache backend, especially in environments where the default cache may be a dummy cache (e.g., for testing or specific deployments), and to support using a dedicated Redis cache if configured. The changes also update tests to ensure cache isolation.Caching backend improvements:
get_fsm_cache()function to select the appropriate cache backend for FSM operations, preferring a Redis cache if specified viaREDIS_CACHE_ALIASin settings, and falling back to the default cache otherwise. This ensures FSM caching works correctly even if the default cache is a dummy backend. The cache backend is memoized for efficiency.cachein FSM state management methods withget_fsm_cache(), ensuring consistent use of the selected cache backend for all FSM cache operations, including get, set, add, delete, and set_many. [1] [2] [3] [4] [5] [6] [7]Testing improvements:
Imports and setup:
cachesfromdjango.core.cacheand importget_fsm_cachein tests. [1] [2]