Fix delay in some tournament messages

This commit is contained in:
Ivo Julca 2014-10-21 20:55:43 -05:00
parent a28301155b
commit d0fb6a1c4e

View File

@ -233,6 +233,7 @@ Tournament = (function () {
} else {
this.removeUser(user);
}
this.room.update();
}
}, this);
};
@ -538,6 +539,7 @@ Tournament = (function () {
if (Date.now() > time + this.autoDisqualifyTimeout && this.isAutoDisqualifyWarned.get(user)) {
this.disqualifyUser(user);
this.room.update();
} else if (Date.now() > time + this.autoDisqualifyTimeout - AUTO_DISQUALIFY_WARNING_TIMEOUT && !this.isAutoDisqualifyWarned.get(user)) {
var remainingTime = this.autoDisqualifyTimeout - Date.now() + time;
if (remainingTime <= 0) {
@ -646,6 +648,7 @@ Tournament = (function () {
this.inProgressMatches.set(challenge.from, {to: user, room: room});
this.room.add('|tournament|battlestart|' + challenge.from.name + '|' + user.name + '|' + room.id);
this.room.update();
this.isBracketInvalidated = true;
this.runAutoDisqualify();
@ -674,14 +677,14 @@ Tournament = (function () {
this.runAutoDisqualify();
this.update();
return;
return this.room.update();
}
var error = this.generator.setMatchResult([from, to], result, room.battle.score);
if (error) {
// Should never happen
this.room.add("Unexpected " + error + " from setMatchResult([" + from.userid + ", " + to.userid + "], " + result + ", " + room.battle.score + ") in onBattleWin(" + room.id + ", " + winner.userid + "). Please report this to an admin.");
return;
return this.room.update();
}
this.room.add('|tournament|battleend|' + from.name + '|' + to.name + '|' + result + '|' + room.battle.score.join(','));
@ -699,6 +702,7 @@ Tournament = (function () {
this.runAutoDisqualify();
this.update();
}
this.room.update();
};
Tournament.prototype.onTournamentEnd = function () {
this.room.add('|tournament|end|' + JSON.stringify({