From 84116349aba0e7846c2856e8c4028c740d3eec49 Mon Sep 17 00:00:00 2001 From: Chris Meyers Date: Thu, 24 Jun 2021 16:00:17 -0400 Subject: [PATCH] reload settings on fork or new thread * Reloading settings will re-import cache. Django cache is thread aware, but keeping an old reference to the cache avoids the awareness. --- awx/main/utils/common.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/awx/main/utils/common.py b/awx/main/utils/common.py index 6a962c6ce5..35ce3da945 100644 --- a/awx/main/utils/common.py +++ b/awx/main/utils/common.py @@ -1086,8 +1086,11 @@ def cleanup_new_process(func): @wraps(func) def wrapper_cleanup_new_process(*args, **kwargs): + from awx.conf.settings import SettingsWrapper # noqa + django_connection.close() django_cache.close() + SettingsWrapper.initialize() return func(*args, **kwargs) return wrapper_cleanup_new_process