Skip to content

Commit a9f0030

Browse files
committed
Read multiple elements in one read from stream
1 parent ca0bf97 commit a9f0030

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

llmstack/assets/stream.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ async def read_async(self, start_index=0, timeout=10, cancel_event=None):
102102

103103
try:
104104
while True:
105-
stream = objref_stream_client.xread(count=1, streams={self.objref: message_index}, block=timeout)
105+
stream = objref_stream_client.xread(count=1000, streams={self.objref: message_index}, block=timeout)
106106
if cancel_event and cancel_event.is_set():
107107
break
108108

@@ -116,7 +116,7 @@ async def read_async(self, start_index=0, timeout=10, cancel_event=None):
116116
if chunk_index == -1 or chunk == b"":
117117
break
118118

119-
await asyncio.sleep(0.0001)
119+
await asyncio.sleep(0.00001)
120120
except Exception as e:
121121
logger.error(f"Error reading stream: {e}")
122122
yield b""

0 commit comments

Comments
 (0)