mirror of https://github.com/zulip/zulip.git
flush-memcached: Explicitly close memcached connection.
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>
This commit is contained in:
parent
a0efc0ee76
commit
c8eaceff21
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue