Files
zulip/scripts/setup/flush-memcached
Tim Abbott 037b87b580 populate_db: Fix handling of memcached flushing.
Our recent fixes to using the system's configured memcached settings
broke populate_db, because its hacky clear_database helper is called
with a hacked-up settings module.

We fix this by first moving this out-of-place code from models.py into
populate_db, and then saving the settings required to access memcached
so that we can use them in clear_database.

We also fix a mypy erorr in flush-memcached that matches the same
issue fixed in clear_database.
2020-01-13 18:23:44 -08:00

17 lines
399 B
Python
Executable File

#!/usr/bin/env python3
import os
import sys
BASE_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), "../..")
sys.path.append(BASE_DIR)
import scripts.lib.setup_path_on_import
from zproject import settings
import pylibmc
pylibmc.Client(
[settings.MEMCACHED_LOCATION],
behaviors=settings.CACHES["default"]["OPTIONS"] # type: ignore # settings not typed properly
).flush_all()