Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

flush-memcached: Explicitly close memcached connection.

Anders Kaseorgc8eaceff2152
diff --git a/scripts/setup/flush-memcached b/scripts/setup/flush-memcached
index 980045ca49a..903c7bb2814 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()