File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed
Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -304,16 +304,16 @@ def __init__(
304304 file_name = self ._header .file_header .file_name ,
305305 )
306306
307- async def write (self , data : bytes , chunk_index : int | None = None ):
308- if len (data ) > STREAM_CHUNK_SIZE :
309- raise ValueError ("maximum chunk size exceeded" )
307+ async def write (self , data : bytes ):
308+ chunked_data = [data [i : i + 2 ] for i in range (0 , len (data ), 2 )]
310309
311- if chunk_index is None :
312- chunk_index = self ._next_chunk_index
310+ for chunk in chunked_data :
313311 self ._next_chunk_index += 1
314- chunk_msg = proto_DataStream .Chunk (
315- stream_id = self ._header .stream_id , chunk_index = chunk_index , content = data
316- )
312+ chunk_msg = proto_DataStream .Chunk (
313+ stream_id = self ._header .stream_id ,
314+ chunk_index = self ._next_chunk_index ,
315+ content = chunk ,
316+ )
317317 await self ._send_chunk (chunk_msg )
318318
319319 @property
You can’t perform that action at this time.
0 commit comments