Used with exhaust cursors to ensure the connection is returned.
| 31 | |
| 32 | |
| 33 | class _ConnectionManager: |
| 34 | """Used with exhaust cursors to ensure the connection is returned.""" |
| 35 | |
| 36 | def __init__(self, conn: AsyncConnection, more_to_come: bool): |
| 37 | self.conn: Optional[AsyncConnection] = conn |
| 38 | self.more_to_come = more_to_come |
| 39 | self._lock = _async_create_lock() |
| 40 | |
| 41 | def update_exhaust(self, more_to_come: bool) -> None: |
| 42 | self.more_to_come = more_to_come |
| 43 | |
| 44 | async def close(self) -> None: |
| 45 | """Return this instance's connection to the connection pool.""" |
| 46 | if self.conn: |
| 47 | await self.conn.unpin() |
| 48 | self.conn = None |
| 49 | |
| 50 | |
| 51 | class _AsyncCursorBase(_AgnosticCursorBase[_DocumentType]): |
no outgoing calls
no test coverage detected