File tree Expand file tree Collapse file tree 1 file changed +5
-6
lines changed
python_packages/jupyter_lsp/jupyter_lsp Expand file tree Collapse file tree 1 file changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -98,9 +98,10 @@ async def read(self) -> None:
98
98
await self .sleep ()
99
99
100
100
def _read_content (
101
- self , length : int , max_parts = 100 , max_empty_parts_in_a_row = 50
101
+ self , length : int , max_parts = 100 , max_empties = 50
102
102
) -> Optional [bytes ]:
103
- """Read the full length of the message unless exceeding max_parts.
103
+ """Read the full length of the message unless exceeding max_parts or
104
+ max_empties empty reads occur.
104
105
105
106
See https://github.com/krassowski/jupyterlab-lsp/issues/450
106
107
@@ -119,13 +120,11 @@ def _read_content(
119
120
raw_parts : List [bytes ] = []
120
121
received_size = 0
121
122
while (
122
- received_size < length
123
- and len (raw_parts ) < max_parts
124
- and max_empty_parts_in_a_row > 0
123
+ received_size < length and len (raw_parts ) < max_parts and max_empties > 0
125
124
):
126
125
part = self .stream .read (length )
127
126
if part is None :
128
- max_empty_parts_in_a_row -= 1
127
+ max_empties -= 1
129
128
continue # pragma: no cover
130
129
received_size += len (part )
131
130
raw_parts .append (part )
You can’t perform that action at this time.
0 commit comments