You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(cache): cache authorizations in Celery tasks via cache_for_request_or_task
@cache_for_request is a no-op in Celery (no request), so per-user authorization
filtering re-runs on every call inside a task -- notably the rules engine, which
runs authorized querysets under impersonate(rule.owner). Add a request-or-task
read-through cache and move the authorized-queryset/permission getters onto it.
- dojo/request_cache: cache_for_request_or_task resolves the store as request
cache -> task cache -> no caching. The task cache is a per-thread store active
only inside a DojoAsyncTask (begin/end), so management commands / shells that
never hit a task boundary do not cache. The key folds get_current_user().pk so
results keyed on user=None (resolved downstream) cannot leak between users on a
reused worker thread or within a task that impersonates multiple owners.
- dojo/celery: DojoAsyncTask installs a fresh task cache before each task and
drops it afterwards (finally), bounding staleness to a single task.
- Migrate all get_authorized_* / authorized_*_id_set / get_*_permissions getters
from @cache_for_request to @cache_for_request_or_task.
- test_caching: cover task-scope caching, per-user isolation, and reset.
0 commit comments