From e8c8f9fab8d73498f6a925f206db5077c3cc7900 Mon Sep 17 00:00:00 2001 From: Frank Weinberg Date: Tue, 13 Mar 2018 23:51:09 +0100 Subject: [PATCH] Write collected game data to a file only once per jam (at jam end). Previous code wrote up to 7 times at the end of a jam, causing significant lag on older machines. Since the data is currently not recoverd on a crash anyways, writing less often will not affect functionality. --- src/com/carolinarollergirls/scoreboard/Game.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/com/carolinarollergirls/scoreboard/Game.java b/src/com/carolinarollergirls/scoreboard/Game.java index 4b91c7174..2dfb42f8c 100644 --- a/src/com/carolinarollergirls/scoreboard/Game.java +++ b/src/com/carolinarollergirls/scoreboard/Game.java @@ -73,7 +73,9 @@ public void snapshot(boolean jamEnd) { JamStats js = findJamStats(period, jam, true); js.snapshot(jamEnd); - saveLock.notifyAll(); + if (jamEnd) { // only write the data to file once per jam to combat lag from writing it multiple times over at the end of each jam + saveLock.notifyAll(); + } } catch (Exception e) { ScoreBoardManager.printMessage("Error catching snapshot: " + e.getMessage()); e.printStackTrace();