Fix race condition starting multiple database downloads (Related #1581)

This commit is contained in:
games647 2018-06-02 21:50:43 +02:00
parent 5058747b10
commit f39141ed53
No known key found for this signature in database
GPG Key ID: BFC68C8708713A88

View File

@ -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");