A simple check to verify that a connection is still working. Return quietly if the connection is still working, otherwise raise an exception. Used internally by `check()`, but also available for client usage, for instance as `!check` callback when a pool is
(conn: CT)
| 547 | |
| 548 | @staticmethod |
| 549 | def check_connection(conn: CT) -> None: |
| 550 | """ |
| 551 | A simple check to verify that a connection is still working. |
| 552 | |
| 553 | Return quietly if the connection is still working, otherwise raise |
| 554 | an exception. |
| 555 | |
| 556 | Used internally by `check()`, but also available for client usage, |
| 557 | for instance as `!check` callback when a pool is created. |
| 558 | """ |
| 559 | if conn.autocommit: |
| 560 | conn.execute("") |
| 561 | else: |
| 562 | conn.autocommit = True |
| 563 | try: |
| 564 | conn.execute("") |
| 565 | finally: |
| 566 | conn.autocommit = False |
| 567 | |
| 568 | def reconnect_failed(self) -> None: |
| 569 | """ |