gateway.websocket: only use pure zlib when payload is big

big here being more than 1024 characters.
This commit is contained in:
Luna Mendes 2018-10-12 23:41:41 -03:00
parent 3d96ccda35
commit 3f54f35dce
1 changed files with 1 additions and 1 deletions

View File

@ -103,7 +103,7 @@ class GatewayWebsocket:
data2 = self.wsp.zctx.flush(zlib.Z_FULL_FLUSH)
await self.ws.send(data1 + data2)
elif self.state and self.state.compress:
elif self.state and self.state.compress and len(encoded) > 1024:
await self.ws.send(zlib.compress(encoded))
else:
await self.ws.send(encoded.decode())