mirror of https://gitlab.com/litecord/litecord.git
gateway.websocket: only use pure zlib when payload is big
big here being more than 1024 characters.
This commit is contained in:
parent
3d96ccda35
commit
3f54f35dce
|
|
@ -103,7 +103,7 @@ class GatewayWebsocket:
|
||||||
data2 = self.wsp.zctx.flush(zlib.Z_FULL_FLUSH)
|
data2 = self.wsp.zctx.flush(zlib.Z_FULL_FLUSH)
|
||||||
|
|
||||||
await self.ws.send(data1 + data2)
|
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))
|
await self.ws.send(zlib.compress(encoded))
|
||||||
else:
|
else:
|
||||||
await self.ws.send(encoded.decode())
|
await self.ws.send(encoded.decode())
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue