From f39141ed537fae44af24ee10d133d67d496f8d9a Mon Sep 17 00:00:00 2001 From: games647 Date: Sat, 2 Jun 2018 21:50:43 +0200 Subject: [PATCH] Fix race condition starting multiple database downloads (Related #1581) --- src/main/java/fr/xephi/authme/service/GeoIpService.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/fr/xephi/authme/service/GeoIpService.java b/src/main/java/fr/xephi/authme/service/GeoIpService.java index 5f1fe86d..64e10d60 100644 --- a/src/main/java/fr/xephi/authme/service/GeoIpService.java +++ b/src/main/java/fr/xephi/authme/service/GeoIpService.java @@ -120,6 +120,9 @@ public class GeoIpService { } } + //set the downloading flag in order to fix race conditions outside + downloading = true; + // File is outdated or doesn't exist - let's try to download the data file! // use bukkit's cached threads bukkitService.runTaskAsynchronously(this::updateDatabase); @@ -130,8 +133,6 @@ public class GeoIpService { * Tries to update the database by downloading a new version from the website. */ private void updateDatabase() { - downloading = true; - ConsoleLogger.info("Downloading GEO IP database, because the old database is older than " + UPDATE_INTERVAL_DAYS + " days or doesn't exist");