Skip to content

Commit 5f5db11

Browse files
committed
make async cursor close() sync
1 parent f1e3962 commit 5f5db11

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

tests/test_cursors.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ async def async_cursor(
213213
request_settings=ydb.BaseRequestSettings(),
214214
)
215215
yield cursor
216-
await greenlet_spawn(cursor.close)
216+
cursor.close()
217217

218218
@pytest.mark.asyncio
219219
async def test_cursor_fetch_one(self, async_cursor: AsyncCursor) -> None:

ydb_dbapi/cursors.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ def close(self) -> None:
350350
if self._state == CursorStatus.closed:
351351
return
352352

353-
self._scroll_stream()
353+
# self._scroll_stream() # No need to scroll since all data is already fetched
354354
self._state = CursorStatus.closed
355355

356356
def __enter__(self) -> Self:
@@ -527,11 +527,11 @@ async def _scroll_stream(self, replace_current: bool = True) -> None:
527527

528528
self._state = CursorStatus.finished
529529

530-
async def close(self) -> None:
530+
def close(self) -> None:
531531
if self._state == CursorStatus.closed:
532532
return
533533

534-
await self._scroll_stream()
534+
# await self._scroll_stream() # No need to scroll since all data is already fetched
535535
self._state = CursorStatus.closed
536536

537537
async def __aenter__(self) -> Self:
@@ -543,4 +543,4 @@ async def __aexit__(
543543
exc: BaseException | None,
544544
tb: object,
545545
) -> None:
546-
await self.close()
546+
self.close()

0 commit comments

Comments
 (0)