From 73205a45cfd68c4878e61d765bacd98859a914ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Nowacki?= <77497496+mpnowacki-reef@users.noreply.github.com> Date: Thu, 25 Jan 2024 10:22:32 +0100 Subject: [PATCH] Update core.py --- channels_redis/core.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/channels_redis/core.py b/channels_redis/core.py index a164059..12dbdeb 100644 --- a/channels_redis/core.py +++ b/channels_redis/core.py @@ -151,6 +151,12 @@ def __init__( # a message back into the main queue before its cleanup has completed self.receive_clean_locks = ChannelLock() + def _packing_kwargs(message): + """ + kwargs passed to msgpack.packb + """ + return {'use_bin_type': True} + def create_pool(self, index): return create_pool(self.hosts[index]) @@ -656,7 +662,7 @@ def serialize(self, message): """ Serializes message to a byte string. """ - value = msgpack.packb(message, use_bin_type=True) + value = msgpack.packb(message, **self._packing_kwargs(message)) if self.crypter: value = self.crypter.encrypt(value)