Browse Source

updated comments, cleaned up conditionals flow

query-for-venues-on-admin-only
Stephen Hess 7 years ago
parent
commit
8e953c60e1
  1. 26
      controller/search_with_appending_results.js

26
controller/search_with_appending_results.js

@ -70,22 +70,17 @@ function setup( apiConfig, esclient, query, should_execute ){
return;
}
// if execution has gotten this far then one of three things happened:
// - the request didn't time out
// - maxRetries has been hit so we're giving up
// - another error occurred
// in either case, handle the error or results
// error handler
// error handler, return immediately
if( err ){
if (_.isObject(err) && err.message) {
req.errors.push( err.message );
} else {
req.errors.push( err );
}
req.errors.push(_.defaultTo(err.message, err));
return;
}
// set response data
else {
// if execution has gotten this far then one of three things happened:
// - success! (the request didn't time out)
// - maxRetries has been hit so we're giving up (too many timeouts),
// docs will be empty
// log that a retry was successful
// most requests succeed on first attempt so this declutters log files
if (currentAttempt > 1) {
@ -112,9 +107,10 @@ function setup( apiConfig, esclient, query, should_execute ){
es_result_count: parseInt(messageParts[2].slice(17, -1))
}
}});
}
logger.debug('[ES response]', docs);
next();
});
debugLog.stopTimer(req, initialTime);
});

Loading…
Cancel
Save