Skip to content

Commit 7b021b2

Browse files
committed
Expire sheets and objref stores
1 parent 076129d commit 7b021b2

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

llmstack/assets/stream.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ def append_chunk(self, chunk: bytes):
3535
)
3636
self._id += 1
3737

38+
# Expire the stream after 20 minutes
39+
objref_stream_client.expire(self.objref, 1200)
40+
3841
def finalize(self):
3942
# Read the stream and finalize the asset
4043
file_bytes = b""
@@ -56,6 +59,9 @@ def finalize(self):
5659
{"chunk": b"", "id": -1},
5760
)
5861

62+
# Expire the stream after 20 minutes
63+
objref_stream_client.expire(self.objref, 1200)
64+
5965
return self._asset.finalize_streaming_asset(file_bytes)
6066

6167
def read(self, start_index=0, timeout=1000):

llmstack/sheets/consumers.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ async def sheet_error(self, event):
7878
async def _append_event_to_redis(self, event):
7979
try:
8080
sheet_run_data_store.rpush(self.run_id, json.dumps(event))
81+
82+
# Expire the stream after 1 day
83+
sheet_run_data_store.expire(self.run_id, 86400)
8184
except Exception as e:
8285
logger.error(f"Error appending event to Redis: {str(e)}")
8386

0 commit comments

Comments
 (0)