mirror of
https://github.com/ansible/awx.git
synced 2026-03-04 10:11:05 -03:30
Only use in-memory cache for database settings, set ttl=5 (#12166)
* Only use in-memory cache for database settings Make necessary adjustments to monkeypatch as it is very vunerable to recursion Remove migration exception that is now redundant Clear cache if a setting is changed * Use dedicated middleware for setting cache stuff Clear cache for each request * Add tests for in-memory cache
This commit is contained in:
@@ -26,6 +26,17 @@ logger = logging.getLogger('awx.main.middleware')
|
||||
perf_logger = logging.getLogger('awx.analytics.performance')
|
||||
|
||||
|
||||
class SettingsCacheMiddleware(MiddlewareMixin):
|
||||
"""
|
||||
Clears the in-memory settings cache at the beginning of a request.
|
||||
We do this so that a script can POST to /api/v2/settings/all/ and then
|
||||
right away GET /api/v2/settings/all/ and see the updated value.
|
||||
"""
|
||||
|
||||
def process_request(self, request):
|
||||
settings._awx_conf_memoizedcache.clear()
|
||||
|
||||
|
||||
class TimingMiddleware(threading.local, MiddlewareMixin):
|
||||
|
||||
dest = '/var/log/tower/profile'
|
||||
|
||||
Reference in New Issue
Block a user