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.

memcached_exporter: Explicitly close memcached connection.

Anders Kaseorgf3c67103cf62
diff --git a/puppet/kandra/files/memcached_exporter b/puppet/kandra/files/memcached_exporter
index 43eb3ddc88d..d39c1ece539 100755
--- a/puppet/kandra/files/memcached_exporter
+++ b/puppet/kandra/files/memcached_exporter
@@ -382,12 +382,13 @@ class MemcachedCollector(Collector):
raw_stats = client.stats("sizes")
sizes_stats = next(iter(raw_stats.values()))
- if sizes_stats.get("sizes_status") == b"disabled" or sizes_stats == {}:
- return
- sizes = sorted([int(x) for x in sizes_stats])
- yield gauge(
- "item_max_bytes", "Largest item (rounded to 32 bytes) in bytes.", value=sizes[-1]
- )
+ if sizes_stats.get("sizes_status") != b"disabled" and sizes_stats != {}:
+ sizes = sorted([int(x) for x in sizes_stats])
+ yield gauge(
+ "item_max_bytes", "Largest item (rounded to 32 bytes) in bytes.", value=sizes[-1]
+ )
+
+ client.disconnect_all()
if __name__ == "__main__":