Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/test_cursors.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ async def async_cursor(
request_settings=ydb.BaseRequestSettings(),
)
yield cursor
await greenlet_spawn(cursor.close)
cursor.close()

@pytest.mark.asyncio
async def test_cursor_fetch_one(self, async_cursor: AsyncCursor) -> None:
Expand Down
6 changes: 2 additions & 4 deletions ydb_dbapi/cursors.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,6 @@ def close(self) -> None:
if self._state == CursorStatus.closed:
return

self._scroll_stream()
self._state = CursorStatus.closed

def __enter__(self) -> Self:
Expand Down Expand Up @@ -527,11 +526,10 @@ async def _scroll_stream(self, replace_current: bool = True) -> None:

self._state = CursorStatus.finished

async def close(self) -> None:
def close(self) -> None:
if self._state == CursorStatus.closed:
return

await self._scroll_stream()
self._state = CursorStatus.closed

async def __aenter__(self) -> Self:
Expand All @@ -543,4 +541,4 @@ async def __aexit__(
exc: BaseException | None,
tb: object,
) -> None:
await self.close()
self.close()