Reapply "Adding concurrency support to some lines which are causing issues on production"

This reverts commit f9dd9d0962.
This commit is contained in:
Christian 'ketura' McCarty
2025-06-21 10:37:42 -05:00
parent f9dd9d0962
commit 653bbb3527

View File

@@ -27,6 +27,7 @@ import java.time.Duration;
import java.time.ZonedDateTime; import java.time.ZonedDateTime;
import java.time.format.DateTimeParseException; import java.time.format.DateTimeParseException;
import java.util.*; import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
public class TournamentService { public class TournamentService {
private final ProductLibrary _productLibrary; private final ProductLibrary _productLibrary;
@@ -47,8 +48,8 @@ public class TournamentService {
private static final Duration _tournamentRepeatPeriod = Duration.ofDays(2); private static final Duration _tournamentRepeatPeriod = Duration.ofDays(2);
private static final int _scheduledTournamentLoadTime = 7; // In days; one week private static final int _scheduledTournamentLoadTime = 7; // In days; one week
private final Map<String, Tournament> _activeTournaments = new LinkedHashMap<>(); private final Map<String, Tournament> _activeTournaments = new ConcurrentHashMap<>();
private final Map<String, TournamentQueue> _tournamentQueues = new LinkedHashMap<>(); private final Map<String, TournamentQueue> _tournamentQueues = new ConcurrentHashMap<>();
public TournamentService(CollectionsManager collectionsManager, ProductLibrary productLibrary, DraftPackStorage draftPackStorage, public TournamentService(CollectionsManager collectionsManager, ProductLibrary productLibrary, DraftPackStorage draftPackStorage,
TournamentDAO tournamentDao, TournamentPlayerDAO tournamentPlayerDao, TournamentMatchDAO tournamentMatchDao, TournamentDAO tournamentDao, TournamentPlayerDAO tournamentPlayerDao, TournamentMatchDAO tournamentMatchDao,
@@ -487,7 +488,7 @@ public class TournamentService {
return result; return result;
} }
public List<Tournament> getLiveTournaments() { public synchronized List<Tournament> getLiveTournaments() {
return new ArrayList<>(_activeTournaments.values()); return new ArrayList<>(_activeTournaments.values());
} }