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