mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-01 03:26:04 +01:00
dont crash sortedSetIncryBy on redis if no callback is supplied
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var helpers = {};
|
var helpers = module.exports;
|
||||||
|
|
||||||
|
helpers.noop = function () {};
|
||||||
|
|
||||||
helpers.toMap = function (data) {
|
helpers.toMap = function (data) {
|
||||||
var map = {};
|
var map = {};
|
||||||
@@ -31,7 +33,3 @@ helpers.valueToString = function (value) {
|
|||||||
|
|
||||||
return value.toString();
|
return value.toString();
|
||||||
};
|
};
|
||||||
|
|
||||||
helpers.noop = function () {};
|
|
||||||
|
|
||||||
module.exports = helpers;
|
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
var helpers = module.exports;
|
var helpers = module.exports;
|
||||||
|
|
||||||
|
helpers.noop = function () {};
|
||||||
|
|
||||||
helpers.multiKeys = function (redisClient, command, keys, callback) {
|
helpers.multiKeys = function (redisClient, command, keys, callback) {
|
||||||
callback = callback || function () {};
|
callback = callback || function () {};
|
||||||
var multi = redisClient.multi();
|
var multi = redisClient.multi();
|
||||||
|
|||||||
@@ -180,6 +180,7 @@ module.exports = function (redisClient, module) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
module.sortedSetIncrBy = function (key, increment, value, callback) {
|
module.sortedSetIncrBy = function (key, increment, value, callback) {
|
||||||
|
callback = callback || helpers.noop;
|
||||||
redisClient.zincrby(key, increment, value, function (err, newValue) {
|
redisClient.zincrby(key, increment, value, function (err, newValue) {
|
||||||
callback(err, !err ? parseFloat(newValue) : undefined);
|
callback(err, !err ? parseFloat(newValue) : undefined);
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user