From c29b68f0305f58431166b8d3100927008aea6d4c Mon Sep 17 00:00:00 2001 From: Oleg Agafonov Date: Sat, 9 Feb 2019 16:09:07 +0400 Subject: [PATCH] Disabled cards rating and classes preloading on startup (lags problem); --- Mage.Client/src/main/java/mage/client/MageFrame.java | 4 +++- Mage.Server/src/main/java/mage/server/Main.java | 6 ++++-- Mage/src/main/java/mage/game/draft/RateCard.java | 2 ++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Mage.Client/src/main/java/mage/client/MageFrame.java b/Mage.Client/src/main/java/mage/client/MageFrame.java index 61be91e0db..43021d6ea0 100644 --- a/Mage.Client/src/main/java/mage/client/MageFrame.java +++ b/Mage.Client/src/main/java/mage/client/MageFrame.java @@ -216,7 +216,9 @@ public class MageFrame extends javax.swing.JFrame implements MageClient { } RepositoryUtil.bootstrapLocalDb(); - RateCard.bootstrapCardsAndRatings(); + if (RateCard.PRELOAD_CARD_RATINGS_ON_STARTUP) { + RateCard.bootstrapCardsAndRatings(); + } ManaSymbols.loadImages(); Plugins.instance.loadPlugins(); diff --git a/Mage.Server/src/main/java/mage/server/Main.java b/Mage.Server/src/main/java/mage/server/Main.java index 10cb4c21bf..53e1599697 100644 --- a/Mage.Server/src/main/java/mage/server/Main.java +++ b/Mage.Server/src/main/java/mage/server/Main.java @@ -137,8 +137,10 @@ public final class Main { logger.info("Done."); // cards preload with ratings - RateCard.bootstrapCardsAndRatings(); - logger.info("Done."); + if (RateCard.PRELOAD_CARD_RATINGS_ON_STARTUP) { + RateCard.bootstrapCardsAndRatings(); + logger.info("Done."); + } logger.info("Updating user stats DB..."); UserStatsRepository.instance.updateUserStats(); diff --git a/Mage/src/main/java/mage/game/draft/RateCard.java b/Mage/src/main/java/mage/game/draft/RateCard.java index 59c2a46bb9..6b6e444b9e 100644 --- a/Mage/src/main/java/mage/game/draft/RateCard.java +++ b/Mage/src/main/java/mage/game/draft/RateCard.java @@ -30,6 +30,8 @@ import java.util.*; */ 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 baseRatings = new HashMap<>(); private static final Map rated = new HashMap<>(); private static boolean isLoaded = false;