Disabled cards rating and classes preloading on startup (lags problem);

This commit is contained in:
Oleg Agafonov 2019-02-09 16:09:07 +04:00
parent e285b2770d
commit c29b68f030
3 changed files with 9 additions and 3 deletions

View file

@ -216,7 +216,9 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
} }
RepositoryUtil.bootstrapLocalDb(); RepositoryUtil.bootstrapLocalDb();
if (RateCard.PRELOAD_CARD_RATINGS_ON_STARTUP) {
RateCard.bootstrapCardsAndRatings(); RateCard.bootstrapCardsAndRatings();
}
ManaSymbols.loadImages(); ManaSymbols.loadImages();
Plugins.instance.loadPlugins(); Plugins.instance.loadPlugins();

View file

@ -137,8 +137,10 @@ public final class Main {
logger.info("Done."); logger.info("Done.");
// cards preload with ratings // cards preload with ratings
if (RateCard.PRELOAD_CARD_RATINGS_ON_STARTUP) {
RateCard.bootstrapCardsAndRatings(); RateCard.bootstrapCardsAndRatings();
logger.info("Done."); logger.info("Done.");
}
logger.info("Updating user stats DB..."); logger.info("Updating user stats DB...");
UserStatsRepository.instance.updateUserStats(); UserStatsRepository.instance.updateUserStats();

View file

@ -30,6 +30,8 @@ import java.util.*;
*/ */
public final class RateCard { public final class RateCard {
public static final boolean PRELOAD_CARD_RATINGS_ON_STARTUP = false; // warning, rating and card classes preloading can cause lags for users with low memory
private static Map<String, Integer> baseRatings = new HashMap<>(); private static Map<String, Integer> baseRatings = new HashMap<>();
private static final Map<String, Integer> rated = new HashMap<>(); private static final Map<String, Integer> rated = new HashMap<>();
private static boolean isLoaded = false; private static boolean isLoaded = false;