-
-
Notifications
You must be signed in to change notification settings - Fork 181
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
Service usage cache and submissions suspended flag #5086
Service usage cache and submissions suspended flag #5086
Conversation
d0e8990
to
274a788
Compare
af2e952
to
e25e1bf
Compare
…esponse for organizations
…nto task-1005-cache-service-usage
…for organizations API
kobo/apps/openrosa/apps/logger/migrations/0029_populate_daily_xform_counters_for_year.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better if we could find a better PR title. It is not really obvious ;-)
…or CachedClass class
…ations that should be pruned later.
kobo/apps/openrosa/apps/logger/migrations/0037_populate_counters.py
Outdated
Show resolved
Hide resolved
…k-1005-cache-service-usage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM . Please leave a comment for InvalidCacheBackendError
as requested and you can merge and close the PR.
Thank you.
Oops, linter does not pass. Please address this before merging the PR ;) |
1 similar comment
…ception in openrosa backend
Description
This PR adds a reusable cache utility for classes to cache function getters. It is then used to cache the service usage calculator results. Some fields from the organization model are no longer needed due to this.
It also adds the submissions_suspended column to the user profile, instead of using the metadata JSON field.
Notes
The cached utility is at kpi.utils.cache, it is used by the ServiceUsageCalculator class. Note that for some tests, the cache has to be disabled, which can be done by patching the CachedClass methods. An example of this can be seen at
kpi/tests/api/v2/test_api_service_usage.py
Related issues
Fixes TASK-1005
Fixes TASK-1003
Part of TASK-872