mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 19:15:58 +01:00 
			
		
		
		
	dont need to call multi if keys.length is 0
This commit is contained in:
		| @@ -363,7 +363,7 @@ module.exports = function (db, module) { | ||||
|  | ||||
| 	module.getSortedSetsMembers = function (keys, callback) { | ||||
| 		if (!Array.isArray(keys) || !keys.length) { | ||||
| 			return callback(null, []); | ||||
| 			return setImmediate(callback, null, []); | ||||
| 		} | ||||
| 		db.collection('objects').find({ _key: { $in: keys } }, { projection: { _id: 0, score: 0 } }).sort({ score: 1 }).toArray(function (err, data) { | ||||
| 			if (err) { | ||||
|   | ||||
| @@ -172,6 +172,9 @@ module.exports = function (redisClient, module) { | ||||
| 	}; | ||||
|  | ||||
| 	module.getSortedSetsMembers = function (keys, callback) { | ||||
| 		if (!Array.isArray(keys) || !keys.length) { | ||||
| 			return setImmediate(callback, null, []); | ||||
| 		} | ||||
| 		var multi = redisClient.multi(); | ||||
| 		for (var i = 0; i < keys.length; i += 1) { | ||||
| 			multi.zrange(keys[i], 0, -1); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user