Framework Update
This commit is contained in:
+18
-5
@@ -197,8 +197,11 @@ trait RedisTrait
|
||||
if (!isset($params['redis_sentinel'])) {
|
||||
break;
|
||||
}
|
||||
|
||||
$sentinel = new \RedisSentinel($host, $port, $params['timeout'], (string) $params['persistent_id'], $params['retry_interval'], $params['read_timeout']);
|
||||
$extra = [];
|
||||
if (\defined('Redis::OPT_NULL_MULTIBULK_AS_NULL') && isset($params['auth'])) {
|
||||
$extra = [$params['auth']];
|
||||
}
|
||||
$sentinel = new \RedisSentinel($host, $port, $params['timeout'], (string) $params['persistent_id'], $params['retry_interval'], $params['read_timeout'], ...$extra);
|
||||
|
||||
if ($address = $sentinel->getMasterAddrByName($params['redis_sentinel'])) {
|
||||
[$host, $port] = $address;
|
||||
@@ -210,7 +213,13 @@ trait RedisTrait
|
||||
}
|
||||
|
||||
try {
|
||||
@$redis->{$connect}($host, $port, $params['timeout'], (string) $params['persistent_id'], $params['retry_interval'], $params['read_timeout'], ...\defined('Redis::SCAN_PREFIX') ? [['stream' => $params['ssl'] ?? null]] : []);
|
||||
$extra = [
|
||||
'stream' => $params['ssl'] ?? null,
|
||||
];
|
||||
if (isset($params['auth'])) {
|
||||
$extra['auth'] = $params['auth'];
|
||||
}
|
||||
@$redis->{$connect}($host, $port, $params['timeout'], (string) $params['persistent_id'], $params['retry_interval'], $params['read_timeout'], ...\defined('Redis::SCAN_PREFIX') ? [$extra] : []);
|
||||
|
||||
set_error_handler(function ($type, $msg) use (&$error) { $error = $msg; });
|
||||
try {
|
||||
@@ -219,7 +228,7 @@ trait RedisTrait
|
||||
restore_error_handler();
|
||||
}
|
||||
if (!$isConnected) {
|
||||
$error = preg_match('/^Redis::p?connect\(\): (.*)/', $error, $error) ? sprintf(' (%s)', $error[1]) : '';
|
||||
$error = preg_match('/^Redis::p?connect\(\): (.*)/', $error ?? '', $error) ? sprintf(' (%s)', $error[1]) : '';
|
||||
throw new InvalidArgumentException(sprintf('Redis connection "%s" failed: ', $dsn).$error.'.');
|
||||
}
|
||||
|
||||
@@ -558,7 +567,11 @@ trait RedisTrait
|
||||
|
||||
if (!$redis instanceof \Predis\ClientInterface && 'eval' === $command && $redis->getLastError()) {
|
||||
$e = new \RedisException($redis->getLastError());
|
||||
$results = array_map(function ($v) use ($e) { return false === $v ? $e : $v; }, $results);
|
||||
$results = array_map(function ($v) use ($e) { return false === $v ? $e : $v; }, (array) $results);
|
||||
}
|
||||
|
||||
if (\is_bool($results)) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($ids as $k => $id) {
|
||||
|
||||
Reference in New Issue
Block a user