diff --git a/scripts/setup/flush-memcached b/scripts/setup/flush-memcached index 980045ca49..903c7bb281 100755 --- a/scripts/setup/flush-memcached +++ b/scripts/setup/flush-memcached @@ -15,4 +15,8 @@ from zproject import settings cache = settings.CACHES["default"] assert isinstance(cache, dict) # for mypy -bmemcached.Client((cache["LOCATION"],), **cache["OPTIONS"]).flush_all() +client = bmemcached.Client((cache["LOCATION"],), **cache["OPTIONS"]) +try: + client.flush_all() +finally: + client.disconnect_all()