Skip to content

Commit 9798499

Browse files
authored
Have to auth after connecting
1 parent e81e97a commit 9798499

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/Factory/RedisFactory.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,16 @@ public function getAdapter(array $config)
3939
throw new ConnectException(sprintf('Could not connect to Redis database on "%s:%s".', $config['host'], $config['port']));
4040
}
4141
} else {
42+
if (false === $client->connect($dsn->getFirstHost(), $dsn->getFirstPort())) {
43+
throw new ConnectException(sprintf('Could not connect to Redis database on "%s:%s".', $dsn->getFirstHost(), $dsn->getFirstPort()));
44+
}
45+
4246
if (!empty($dsn->getPassword())) {
4347
if (false === $client->auth($dsn->getPassword())) {
4448
throw new ConnectException('Could not connect authenticate connection to Redis database.');
4549
}
4650
}
4751

48-
if (false === $client->connect($dsn->getFirstHost(), $dsn->getFirstPort())) {
49-
throw new ConnectException(sprintf('Could not connect to Redis database on "%s:%s".', $dsn->getFirstHost(), $dsn->getFirstPort()));
50-
}
51-
5252
if ($dsn->getDatabase() !== null) {
5353
if (false === $client->select($dsn->getDatabase())) {
5454
throw new ConnectException(sprintf('Could not select Redis database with index "%s".', $dsn->getDatabase()));

0 commit comments

Comments
 (0)