Skip to content

Commit f64c4ad

Browse files
committed
make a formal hook so other types of connections don't have to repeat the same connection setup logic
1 parent 1685fd2 commit f64c4ad

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

redis/connection.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,12 @@ def connect(self):
131131
raise ConnectionError(error_message)
132132

133133
self._sock = sock
134-
self._parser.on_connect(self)
134+
self.on_connect()
135135

136-
self.setup_connection()
136+
def on_connect(self):
137+
"Initialize the connection, authenticate and select a database"
138+
self._parser.on_connect(self)
137139

138-
def setup_connection(self):
139-
"Authenticates and Selects the appropriate database"
140140
# if a password is specified, authenticate
141141
if self.password:
142142
self.send_command('AUTH', self.password)

0 commit comments

Comments
 (0)