Loading scheduled tournaments is limited only to one week in advance.
This commit is contained in:
@@ -190,12 +190,13 @@ public class DbTournamentDAO implements TournamentDAO {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TournamentQueueInfo> getUnstartedScheduledTournamentQueues() {
|
||||
public List<TournamentQueueInfo> getUnstartedScheduledTournamentQueues(long tillDate) {
|
||||
try {
|
||||
Connection connection = _dbAccess.getDataSource().getConnection();
|
||||
try {
|
||||
PreparedStatement statement = connection.prepareStatement("select tournament_id, name, format, start, cost, playoff, prizes, minimum_players from scheduled_tournament where started = 0");
|
||||
PreparedStatement statement = connection.prepareStatement("select tournament_id, name, format, start, cost, playoff, prizes, minimum_players from scheduled_tournament where started = 0 and start<=?");
|
||||
try {
|
||||
statement.setLong(1, tillDate);
|
||||
ResultSet rs = statement.executeQuery();
|
||||
try {
|
||||
List<TournamentQueueInfo> result = new ArrayList<TournamentQueueInfo>();
|
||||
|
||||
@@ -20,6 +20,9 @@ import java.util.concurrent.locks.ReadWriteLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
|
||||
public class HallServer extends AbstractServer {
|
||||
private final int _playerInactivityPeriod = 1000 * 20; // 10 seconds
|
||||
private final long _scheduledTournamentLoadTime = 1000*60*60*24*7; // Week
|
||||
|
||||
private ChatServer _chatServer;
|
||||
private LeagueService _leagueService;
|
||||
private TournamentService _tournamentService;
|
||||
@@ -32,8 +35,6 @@ public class HallServer extends AbstractServer {
|
||||
|
||||
private CollectionType _allCardsCollectionType = CollectionType.ALL_CARDS;
|
||||
|
||||
private final int _playerInactivityPeriod = 1000 * 20; // 10 seconds
|
||||
|
||||
private int _nextTableId = 1;
|
||||
|
||||
private String _motd;
|
||||
@@ -572,7 +573,8 @@ public class HallServer extends AbstractServer {
|
||||
|
||||
if (_tickCounter == 60) {
|
||||
_tickCounter =0;
|
||||
List<TournamentQueueInfo> unstartedTournamentQueues = _tournamentService.getUnstartedScheduledTournamentQueues();
|
||||
List<TournamentQueueInfo> unstartedTournamentQueues = _tournamentService.getUnstartedScheduledTournamentQueues(
|
||||
System.currentTimeMillis()+_scheduledTournamentLoadTime);
|
||||
for (TournamentQueueInfo unstartedTournamentQueue : unstartedTournamentQueues) {
|
||||
String scheduledTournamentId = unstartedTournamentQueue.getScheduledTournamentId();
|
||||
if (!_tournamentQueues.containsKey(scheduledTournamentId)) {
|
||||
|
||||
@@ -19,7 +19,7 @@ public interface TournamentDAO {
|
||||
|
||||
public void updateTournamentRound(String tournamentId, int round);
|
||||
|
||||
public List<TournamentQueueInfo> getUnstartedScheduledTournamentQueues();
|
||||
public List<TournamentQueueInfo> getUnstartedScheduledTournamentQueues(long tillDate);
|
||||
|
||||
public void updateScheduledTournamentStarted(String scheduledTournamentId);
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ public class TournamentService {
|
||||
return _tournamentMatchDao.getPlayerByes(tournamentId);
|
||||
}
|
||||
|
||||
public List<TournamentQueueInfo> getUnstartedScheduledTournamentQueues() {
|
||||
public List<TournamentQueueInfo> getUnstartedScheduledTournamentQueues(long tillDate) {
|
||||
return _tournamentDao.getUnstartedScheduledTournamentQueues();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user