Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

invoke callback if list of waiting matches returns an empty array

  • Loading branch information...
commit c43b0ab2084cb2b88d93ab6d355c85d8d70f157a 1 parent ef03c83
Moritz Kleine authored
Showing with 4 additions and 4 deletions.
  1. +4 −4 server/js-nodejs/src/main/js/core-foos-server.js
8 server/js-nodejs/src/main/js/core-foos-server.js
View
@@ -140,10 +140,7 @@ var startMatch = function (callback) {
getListOfMatches(function (docs) {
- if(!docs) {
- logger.warn("There's no match to start");
- callback();
- } else if (docs.length > 0) {
+ if (docs && docs.length > 0) {
var match = docs[0];
var date = new Date();
mongo.upsert(matches, {_id:match._id}, {state:MATCH_STATE_ACTIVE, startDate:date}, function () {
@@ -151,6 +148,9 @@ var startMatch = function (callback) {
match.startDate = date;
callback(match);
});
+ } else {
+ logger.warn("There's no match to start");
+ callback();
}
});
Please sign in to comment.
Something went wrong with that request. Please try again.