Fix rate limit exception in update checker (#4731)

This commit is contained in:
Josh Roy 2022-01-02 12:24:32 -05:00 committed by GitHub
parent 739600eb05
commit bb88a6a749
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -96,9 +96,8 @@ public final class UpdateChecker {
// Locally built? // Locally built?
pendingReleaseFuture.complete(cachedRelease = new RemoteVersion(BranchStatus.UNKNOWN)); pendingReleaseFuture.complete(cachedRelease = new RemoteVersion(BranchStatus.UNKNOWN));
break catchBlock; break catchBlock;
} } else if (connection.getResponseCode() == HttpURLConnection.HTTP_INTERNAL_ERROR || connection.getResponseCode() == HttpURLConnection.HTTP_FORBIDDEN) {
if (connection.getResponseCode() == HttpURLConnection.HTTP_INTERNAL_ERROR) { // GitHub is down or rate limit exceeded
// Github is down
pendingReleaseFuture.complete(new RemoteVersion(BranchStatus.ERROR)); pendingReleaseFuture.complete(new RemoteVersion(BranchStatus.ERROR));
break catchBlock; break catchBlock;
} }
@ -146,8 +145,7 @@ public final class UpdateChecker {
if (connection.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND) { if (connection.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND) {
// Locally built? // Locally built?
return new RemoteVersion(BranchStatus.UNKNOWN); return new RemoteVersion(BranchStatus.UNKNOWN);
} } else if (connection.getResponseCode() == HttpURLConnection.HTTP_INTERNAL_ERROR || connection.getResponseCode() == HttpURLConnection.HTTP_FORBIDDEN) {
if (connection.getResponseCode() == HttpURLConnection.HTTP_INTERNAL_ERROR || connection.getResponseCode() == HttpURLConnection.HTTP_FORBIDDEN) {
// GitHub is down or we hit a local rate limit // GitHub is down or we hit a local rate limit
return new RemoteVersion(BranchStatus.ERROR); return new RemoteVersion(BranchStatus.ERROR);
} }