diff --git a/src/main/java/com/gmail/nossr50/runnables/database/UUIDUpdateAsyncTask.java b/src/main/java/com/gmail/nossr50/runnables/database/UUIDUpdateAsyncTask.java index a97f11c25..78a44dd7b 100644 --- a/src/main/java/com/gmail/nossr50/runnables/database/UUIDUpdateAsyncTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/database/UUIDUpdateAsyncTask.java @@ -18,6 +18,7 @@ import com.gmail.nossr50.util.uuid.UUIDFetcher; public class UUIDUpdateAsyncTask extends BukkitRunnable { private mcMMO plugin; private static final int MAX_LOOKUP = Math.max(HiddenConfig.getInstance().getUUIDConvertAmount(), 100); + private static final int BATCH_SIZE = 5000; private List userNames; private int size; @@ -64,9 +65,13 @@ public class UUIDUpdateAsyncTask extends BukkitRunnable { size = userNames.size(); Misc.printProgress(checkedUsers, DatabaseManager.progressInterval, startMillis); + if (fetchedUUIDs.size() > BATCH_SIZE) { + mcMMO.getDatabaseManager().saveUserUUIDs(fetchedUUIDs); + fetchedUUIDs = new HashMap(); + } } - if (mcMMO.getDatabaseManager().saveUserUUIDs(fetchedUUIDs)) { + if (fetchedUUIDs.size() == 0 || mcMMO.getDatabaseManager().saveUserUUIDs(fetchedUUIDs)) { mcMMO.getUpgradeManager().setUpgradeCompleted(UpgradeType.ADD_UUIDS); plugin.getLogger().info("UUID upgrade completed!"); }