mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 14:46:46 +01:00
Try again later when Mojang ratelimits us
This commit is contained in:
parent
e51809d066
commit
2c940ecdac
@ -68,6 +68,17 @@ public class UUIDUpdateAsyncTask extends BukkitRunnable {
|
|||||||
fetchedUUIDs.putAll(new UUIDFetcher(userNamesSection).call());
|
fetchedUUIDs.putAll(new UUIDFetcher(userNamesSection).call());
|
||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
|
// Handle 429
|
||||||
|
if (e.getMessage().contains("429")) {
|
||||||
|
try {
|
||||||
|
Thread.sleep(LIMIT_PERIOD);
|
||||||
|
} catch (InterruptedException ex) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
plugin.getLogger().log(Level.SEVERE, "Unable to fetch UUIDs!", e);
|
plugin.getLogger().log(Level.SEVERE, "Unable to fetch UUIDs!", e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -77,7 +88,7 @@ public class UUIDUpdateAsyncTask extends BukkitRunnable {
|
|||||||
size = userNames.size();
|
size = userNames.size();
|
||||||
|
|
||||||
Misc.printProgress(checkedUsers, DatabaseManager.progressInterval, startMillis);
|
Misc.printProgress(checkedUsers, DatabaseManager.progressInterval, startMillis);
|
||||||
if (fetchedUUIDs.size() > BATCH_SIZE) {
|
if (fetchedUUIDs.size() >= BATCH_SIZE) {
|
||||||
mcMMO.getDatabaseManager().saveUserUUIDs(fetchedUUIDs);
|
mcMMO.getDatabaseManager().saveUserUUIDs(fetchedUUIDs);
|
||||||
fetchedUUIDs = new HashMap<String, UUID>();
|
fetchedUUIDs = new HashMap<String, UUID>();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user