redlock-php
redlock-php copied to clipboard
Fatal error: Uncaught exception 'RedisException' with message 'read error on connection'
when i test the redlock file, the program terminates with following fatal error:
Fatal error: Uncaught exception 'RedisException' with message 'read error on connection' in C:\OpenSource\xampp\htdocs\demo\vendor\ronnylt\redlock-php\src\RedLock.php on line 99 RedisException: read error on connection in C:\OpenSource\xampp\htdocs\demo\vendor\ronnylt\redlock-php\src\RedLock.php on line 99
The test code is as follow:
$servers = [
['127.0.0.1', 6379, 0.01]
];
$redLock = new RedLock($servers);
$i = 0;
while ($i<100) {
echo $i."\r\n";
$lock = $redLock->lock('newOrder', 1000);
if ($lock) {
var_dump($lock);
} else {
echo "Lock not acquired\r\n";
}
$i++;
}
Sometimes it runs without error, however, it terminates with error most of the time, what's the problem?
Try with unlimited timeout, this solves my problem.
$servers = [
['127.0.0.1', 6379, 0],
];