Add redis version check so errors are thrown if you use too old of a redis version
This commit is contained in:
parent
2eef180751
commit
ac7d7780fd
|
@ -170,7 +170,7 @@ Inside the `config_example.json` file, ensure the default configuration will wor
|
||||||
Explanation for each field:
|
Explanation for each field:
|
||||||
````javascript
|
````javascript
|
||||||
{
|
{
|
||||||
/* Specifies the level of log output verbosity. Anything more severy than the level specified
|
/* Specifies the level of log output verbosity. Anything more severe than the level specified
|
||||||
will also be logged. */
|
will also be logged. */
|
||||||
"logLevel": "debug", //or "warning", "error"
|
"logLevel": "debug", //or "warning", "error"
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@ value: a hash with..
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
module.exports = function(logger, poolConfig){
|
module.exports = function(logger, poolConfig){
|
||||||
|
|
||||||
var redisConfig = poolConfig.redis;
|
var redisConfig = poolConfig.redis;
|
||||||
|
@ -38,6 +39,31 @@ module.exports = function(logger, poolConfig){
|
||||||
logger.error(logSystem, logComponent, logSubCat, 'Connection to redis database as been ended');
|
logger.error(logSystem, logComponent, logSubCat, 'Connection to redis database as been ended');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
connection.info(function(error, response){
|
||||||
|
if (error){
|
||||||
|
logger.error(logSystem, logComponent, logSubCat, 'Redis version check failed');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var parts = response.split('\r\n');
|
||||||
|
var version;
|
||||||
|
var versionString;
|
||||||
|
for (var i = 0; i < parts.length; i++){
|
||||||
|
if (parts[i].indexOf(':') !== -1){
|
||||||
|
var valParts = parts[i].split(':');
|
||||||
|
if (valParts[0] === 'redis_version'){
|
||||||
|
versionString = valParts[1];
|
||||||
|
version = parseFloat(versionString);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!version){
|
||||||
|
logger.error(logSystem, logComponent, logSubCat, 'Could not detect redis version - but be super old or broken');
|
||||||
|
}
|
||||||
|
else if (version < 2.6){
|
||||||
|
logger.error(logSystem, logComponent, logSubCat, "You're using redis version " + versionString + " the minimum required version is 2.6. Follow the damn usage instructions...");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
this.handleShare = function(isValidShare, isValidBlock, shareData){
|
this.handleShare = function(isValidShare, isValidBlock, shareData){
|
||||||
|
|
Loading…
Reference in New Issue