MCPcopy
hub / github.com/redis/redis-py / make_connection

Method make_connection

redis/connection.py:3507–3538  ·  view source on GitHub ↗

Make a fresh connection.

(self)

Source from the content-addressed store, hash-verified

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=["*"],

Callers 1

get_connectionMethod · 0.95

Calls 6

get_pool_nameFunction · 0.90
record_connection_countFunction · 0.50
acquireMethod · 0.45
appendMethod · 0.45
releaseMethod · 0.45

Tested by

no test coverage detected