Added support for websocket streaming cursor.

This commit is contained in:
2025-02-26 05:13:24 +03:00
parent efbca3b7cb
commit 41d98aafe9
3 changed files with 50 additions and 11 deletions

View File

@@ -11,6 +11,7 @@ closed_cached_cursors: dict[str, CachedCursor] = {}
cached_cursors_cleaner_task = None
async def close_old_cached_cursors():
global cached_cursors, closed_cached_cursors
@@ -46,13 +47,12 @@ async def remove_old_closed_cached_cursors():
del closed_cached_cursors[cursor_id]
print(f"Removed cursor {cursor_id}")
async def cached_cursors_cleaner():
global cached_cursors, closed_cached_cursors
while True:
print("hey")
await close_old_cached_cursors()
await remove_old_closed_cached_cursors()
await asyncio.sleep(10)
@@ -69,6 +69,7 @@ async def pool_creator(connection: Connection, minsize=5, maxsize=10):
maxsize=maxsize,
)
async def create_cursor(connection_id: int, query: SelectQuery) -> CachedCursor:
pool = pools.get(connection_id, None)