Skip to content

Commit c348a25

Browse files
committed
Merge branch 'long-term-memory-interface' of https://github.com/redis-developer/agent-memory-server into long-term-memory-interface
2 parents 70964b0 + f2445da commit c348a25

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

tests/test_memory_compaction.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,20 @@ def add_task(self, func, *args, **kwargs):
158158
# Add a small delay to ensure indexing is complete
159159
import asyncio
160160

161-
await asyncio.sleep(0.1)
161+
# Poll until indexing is complete or timeout is reached
162+
timeout = 5 # seconds
163+
start_time = time.time()
164+
while True:
165+
remaining_before = await count_long_term_memories(
166+
redis_client=async_redis_client,
167+
namespace=test_namespace,
168+
session_id=test_session,
169+
)
170+
if remaining_before == 2:
171+
break
172+
if time.time() - start_time > timeout:
173+
raise TimeoutError("Indexing did not complete within the timeout period.")
174+
await asyncio.sleep(0.01) # Avoid busy-waiting
162175

163176
# Debug: Check what keys exist in Redis
164177
keys = await async_redis_client.keys("*")

0 commit comments

Comments
 (0)