Make a fresh connection.
(self)
| 3505 | pass |
| 3506 | |
| 3507 | def make_connection(self): |
| 3508 | "Make a fresh connection." |
| 3509 | try: |
| 3510 | if self._in_maintenance: |
| 3511 | self._lock.acquire() |
| 3512 | self._locked = True |
| 3513 | |
| 3514 | if self.cache is not None: |
| 3515 | connection = CacheProxyConnection( |
| 3516 | self.connection_class(**self.connection_kwargs), |
| 3517 | self.cache, |
| 3518 | self._lock, |
| 3519 | ) |
| 3520 | else: |
| 3521 | connection = self.connection_class(**self.connection_kwargs) |
| 3522 | self._connections.append(connection) |
| 3523 | |
| 3524 | # Record new connection created (starts as IDLE) |
| 3525 | record_connection_count( |
| 3526 | pool_name=get_pool_name(self), |
| 3527 | connection_state=ConnectionState.IDLE, |
| 3528 | counter=1, |
| 3529 | ) |
| 3530 | |
| 3531 | return connection |
| 3532 | finally: |
| 3533 | if self._locked: |
| 3534 | try: |
| 3535 | self._lock.release() |
| 3536 | except Exception: |
| 3537 | pass |
| 3538 | self._locked = False |
| 3539 | |
| 3540 | @deprecated_args( |
| 3541 | args_to_warn=["*"], |
no test coverage detected