diff --git a/README.md b/README.md index c7bd804..95146bc 100644 --- a/README.md +++ b/README.md @@ -170,7 +170,7 @@ Inside the `config_example.json` file, ensure the default configuration will wor Explanation for each field: ````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. */ "logLevel": "debug", //or "warning", "error" diff --git a/libs/shareProcessor.js b/libs/shareProcessor.js index 2632174..64fc188 100644 --- a/libs/shareProcessor.js +++ b/libs/shareProcessor.js @@ -14,6 +14,7 @@ value: a hash with.. */ + module.exports = function(logger, poolConfig){ 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'); }); + 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){