mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-01 22:15:08 +00:00
further improve mojang api rate limit handling
This commit is contained in:
1 file changed
+7
-1
@@ -119,7 +119,13 @@ public final class MojangProfileResolver implements ProfileResolver {
|
||||
return CompletableFuture.completedFuture(this.cache.cachedName(uuid));
|
||||
}
|
||||
return this.pendingUsernameLookups.computeIfAbsent(uuid, $ -> {
|
||||
if (!this.globalRateLimit.canSubmit() || !this.uuidToProfileRateLimit.canSubmit()) {
|
||||
final boolean globalLimited = !this.globalRateLimit.canSubmit();
|
||||
final boolean nameLimited = !this.uuidToProfileRateLimit.canSubmit();
|
||||
if (globalLimited || nameLimited) {
|
||||
if (nameLimited && !globalLimited) {
|
||||
// Add back to the global limit if we didn't actually make a request due to uuidToProfileRateLimit
|
||||
this.globalRateLimit.available.getAndIncrement();
|
||||
}
|
||||
return CompletableFuture.completedFuture(null);
|
||||
}
|
||||
final CompletableFuture<@Nullable BasicLookupResponse> mojangLookup = CompletableFuture.supplyAsync(() -> {
|
||||
|
||||
Reference in new issue
Block a user