(self)
| 163 | return not self._in_use |
| 164 | |
| 165 | async def connect(self) -> None: |
| 166 | if self._con is not None: |
| 167 | raise exceptions.InternalClientError( |
| 168 | 'PoolConnectionHolder.connect() called while another ' |
| 169 | 'connection already exists') |
| 170 | |
| 171 | generation = self._pool._generation |
| 172 | con = await self._pool._get_new_connection() |
| 173 | if self._pool.is_closing(): |
| 174 | await con.close() |
| 175 | raise exceptions.InterfaceError('pool is closing') |
| 176 | if con.is_closed(): |
| 177 | raise exceptions.ConnectionDoesNotExistError( |
| 178 | 'connection was closed during pool initialization') |
| 179 | self._con = con |
| 180 | # Notify live holders without keeping an abandoned pool alive. |
| 181 | con._pool_holder = weakref.ref(self) |
| 182 | self._generation = generation |
| 183 | self._maybe_cancel_inactive_callback() |
| 184 | self._setup_inactive_callback() |
| 185 | |
| 186 | async def acquire(self) -> PoolConnectionProxy: |
| 187 | if self._con is None or self._con.is_closed(): |
no test coverage detected