We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents f62f986 + 735513f commit 592c4dcCopy full SHA for 592c4dc
1 file changed
src/electrumx/server/transport.py
@@ -24,6 +24,9 @@ class PaddedRSTransport(RSTransport):
24
25
MIN_PACKET_SIZE = 1024
26
WAIT_FOR_BUFFER_GROWTH_SECONDS = 1.0
27
+ # amount of (unpadded) bytes sent instantly before beginning with polling.
28
+ # This makes the initial handshake where a few small messages are exchanged faster.
29
+ WARMUP_BUDGET_SIZE = 1024
30
31
session: Optional['RPCSessionWithTaskGroup']
32
@@ -57,6 +60,7 @@ def _maybe_consume_sbuffer(self) -> None:
57
60
self._force_send
58
61
or len(buf) >= self.MIN_PACKET_SIZE
59
62
or self._last_send + self.WAIT_FOR_BUFFER_GROWTH_SECONDS < time.monotonic()
63
+ or self.session.send_size < self.WARMUP_BUDGET_SIZE
64
):
65
return
66
assert buf[-2:] in (b"}\n", b"]\n"), f"unexpected json-rpc terminator: {buf[-2:]=!r}"
0 commit comments