From 38293e46591f7e0578cbadb72d34d549f87fc19c Mon Sep 17 00:00:00 2001 From: Oleg Agafonov Date: Fri, 1 Mar 2019 19:40:39 +0400 Subject: [PATCH] * Improved network performance (traffic reduced from lobby by 60%); --- .../src/main/java/mage/client/table/TablesPanel.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Mage.Client/src/main/java/mage/client/table/TablesPanel.java b/Mage.Client/src/main/java/mage/client/table/TablesPanel.java index bcf85923ef..ee1265c90d 100644 --- a/Mage.Client/src/main/java/mage/client/table/TablesPanel.java +++ b/Mage.Client/src/main/java/mage/client/table/TablesPanel.java @@ -61,6 +61,11 @@ public class TablesPanel extends javax.swing.JPanel { private static final Logger LOGGER = Logger.getLogger(TablesPanel.class); private static final int[] DEFAULT_COLUMNS_WIDTH = {35, 150, 100, 50, 120, 180, 80, 120, 80, 60, 40, 40, 60}; + // refresh timeouts for data downloads from server + public static final int REFRESH_ACTIVE_TABLES_SECS = 5; + public static final int REFRESH_FINISHED_TABLES_SECS = 30; + public static final int REFRESH_PLAYERS_SECS = 10; + private final TablesTableModel tableModel; private final MatchesTableModel matchesModel; private UUID roomId; @@ -1661,7 +1666,8 @@ class UpdateTablesTask extends SwingWorker> { if (tables != null) { this.publish(tables); } - TimeUnit.SECONDS.sleep(3); + + TimeUnit.SECONDS.sleep(TablesPanel.REFRESH_ACTIVE_TABLES_SECS); } return null; } @@ -1705,7 +1711,7 @@ class UpdatePlayersTask extends SwingWorker> { protected Void doInBackground() throws Exception { while (!isCancelled()) { this.publish(SessionHandler.getRoomUsers(roomId)); - TimeUnit.SECONDS.sleep(3); + TimeUnit.SECONDS.sleep(TablesPanel.REFRESH_PLAYERS_SECS); } return null; } @@ -1746,7 +1752,7 @@ class UpdateMatchesTask extends SwingWorker> { if (!matches.isEmpty()) { this.publish(matches); } - TimeUnit.SECONDS.sleep(10); + TimeUnit.SECONDS.sleep(TablesPanel.REFRESH_FINISHED_TABLES_SECS); } return null; }