mirror of
https://github.com/zulip/zulip.git
synced 2025-10-28 02:23:57 +00:00
Fixes warnings like “ResourceWarning: unclosed <socket.socket fd=3,
family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0,
laddr=('127.0.0.1', 33332), raddr=('127.0.0.1', 11211)>” with warnings
enabled.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
23 lines
472 B
Python
Executable File
23 lines
472 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)
|
|
|
|
from scripts.lib.setup_path import setup_path
|
|
|
|
setup_path()
|
|
|
|
import bmemcached
|
|
|
|
from zproject import settings
|
|
|
|
cache = settings.CACHES["default"]
|
|
assert isinstance(cache, dict) # for mypy
|
|
client = bmemcached.Client((cache["LOCATION"],), **cache["OPTIONS"])
|
|
try:
|
|
client.flush_all()
|
|
finally:
|
|
client.disconnect_all()
|