mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-22 14:42:40 +01:00
pylightning: Increase buffer size for big JSON-RPC responses
This was causing `listchannels` to be incredibly slow. The response is several megabyte in size, and we were only buffering 1Kb on each iteration. Signed-off-by: Christian Decker <decker.christian@gmail.com>
This commit is contained in:
parent
b2ee53fd89
commit
7314c71695
1 changed files with 2 additions and 2 deletions
|
@ -33,7 +33,7 @@ class UnixDomainSocketRpc(object):
|
|||
return self._readobj(sock, buff)
|
||||
while True:
|
||||
try:
|
||||
b = sock.recv(1024)
|
||||
b = sock.recv(max(1024, len(buff)))
|
||||
buff += b
|
||||
|
||||
if b'\n\n' in buff:
|
||||
|
@ -58,7 +58,7 @@ class UnixDomainSocketRpc(object):
|
|||
parts = buff.split(b'\n\n', 1)
|
||||
if len(parts) == 1:
|
||||
# Didn't read enough.
|
||||
b = sock.recv(1024)
|
||||
b = sock.recv(max(1024, len(buff)))
|
||||
buff += b
|
||||
if len(b) == 0:
|
||||
return {'error': 'Connection to RPC server lost.'}, buff
|
||||
|
|
Loading…
Add table
Reference in a new issue