Skip to content

Commit

Permalink
Move CACHES import into function scope to prevent side effects.
Browse files Browse the repository at this point in the history
  • Loading branch information
rtibbles committed Jul 14, 2022
1 parent d150cb3 commit ec849f5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion kolibri/utils/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
from kolibri.core.upgrade import matches_version
from kolibri.core.upgrade import run_upgrades
from kolibri.core.utils.cache import process_cache
from kolibri.deployment.default.cache import CACHES
from kolibri.deployment.default.sqlite_db_names import ADDITIONAL_SQLITE_DATABASES
from kolibri.plugins.utils import autoremove_unavailable_plugins
from kolibri.plugins.utils import check_plugin_config_file_location
Expand Down Expand Up @@ -225,6 +224,10 @@ def _upgrades_before_django_setup(updated, version):


def _post_django_initialization():
# Import here to prevent the module level access to Kolibri options
# which causes premature registration of Kolibri plugins.
from kolibri.deployment.default.cache import CACHES

if "process_cache" in CACHES: # usually it means not using redis
if "DatabaseCache" not in CACHES["process_cache"]["BACKEND"]:
try:
Expand Down

0 comments on commit ec849f5

Please sign in to comment.