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: Switch to zstd compression.

Alex Vandiver33e6d78f3b44
diff --git a/zerver/lib/singleton_bmemcached.py b/zerver/lib/singleton_bmemcached.py
index c3f40437371..ef38b7270e2 100644
--- a/zerver/lib/singleton_bmemcached.py
+++ b/zerver/lib/singleton_bmemcached.py
@@ -2,12 +2,15 @@ import pickle
from functools import lru_cache
from typing import Any
+import zstd
from django_bmemcached.memcached import BMemcached
@lru_cache(None)
-def _get_bmemcached(location: str, params: bytes) -> BMemcached:
- return BMemcached(location, pickle.loads(params)) # noqa: S301
+def _get_bmemcached(location: str, param_bytes: bytes) -> BMemcached:
+ params = pickle.loads(param_bytes) # noqa: S301
+ params["OPTIONS"]["compression"] = zstd
+ return BMemcached(location, params)
def SingletonBMemcached(location: str, params: dict[str, Any]) -> BMemcached: