Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

return null for error in callback #28

Merged
merged 1 commit into from Jan 21, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 10 additions & 4 deletions lib/memcached.js
Expand Up @@ -574,12 +574,15 @@ Client.config = {
memcached.getMulti = function getMulti(keys, callback){
var memcached = this
, responses = {}
, errors = []
, errors = null
, calls

// handle multiple responses and cache them untill we receive all.
, handle = function(err, results){
if (err) errors.push(err);
if (err) {
errors || (errors = []);
errors.push(err);
}

// add all responses to the array
(Array.isArray(results) ? results : [results]).forEach(function(value){ Utils.merge(responses, value) });
Expand Down Expand Up @@ -693,12 +696,15 @@ Client.config = {
private.singles = function singles(type, callback){
var memcached = this
, responses = []
, errors = []
, errors = null
, calls

// handle multiple servers
, handle = function(err, results){
if (err) errors.push(err);
if (err) {
errors || (errors = []);
errors.push(err);
}
if (results) responses = responses.concat(results);

// multi calls should ALWAYS return an array!
Expand Down