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