redis: connect before authenticating

otherwise we get "Uncaught RedisException: Redis server went away" on Redis->auth()
This commit is contained in:
Alex Xu 2020-01-19 02:21:23 +00:00 committed by GitHub
parent 5ea2ff473e
commit 5c59910e54
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -8,12 +8,12 @@ class MemWrapper {
function __construct() {
$this->redis = new Redis();
$this->redis->connect(getConfig("redis_host"), getConfig("redis_port"))
or die ("Server could not connect to Redis!\n");
if (getConfig("redis_use_auth")) {
$this->redis->auth(getConfig("redis_auth"))
or die("Incorrect Redis authentication!");
}
$this->redis->connect(getConfig("redis_host"), getConfig("redis_port"))
or die ("Server could not connect to Redis!\n");
}
function get($key) {