(
self, connection: DBAPIConnection, *, terminate: bool = False
)
| 359 | return lambda rec: creator_fn() |
| 360 | |
| 361 | def _close_connection( |
| 362 | self, connection: DBAPIConnection, *, terminate: bool = False |
| 363 | ) -> None: |
| 364 | self.logger.debug( |
| 365 | "%s connection %r", |
| 366 | "Hard-closing" if terminate else "Closing", |
| 367 | connection, |
| 368 | ) |
| 369 | try: |
| 370 | if terminate: |
| 371 | self._dialect.do_terminate(connection) |
| 372 | else: |
| 373 | self._dialect.do_close(connection) |
| 374 | except BaseException as e: |
| 375 | self.logger.error( |
| 376 | f"Exception {'terminating' if terminate else 'closing'} " |
| 377 | f"connection %r", |
| 378 | connection, |
| 379 | exc_info=True, |
| 380 | ) |
| 381 | if not isinstance(e, Exception): |
| 382 | raise |
| 383 | |
| 384 | def _create_connection(self) -> ConnectionPoolEntry: |
| 385 | """Called by subclasses to create a new ConnectionRecord.""" |
no test coverage detected