Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
feat: retry admin request limit exceeded error (#669)
* feat: retry admin request limit exceeded error Automatically retry requests that fail because the admin requests per seconds limit has been exceeded using an exponential backoff. Fixes #655 and others * fix: remove unused variable * fix: extract strings to constants
- Loading branch information
Showing
with
384 additions
and 103 deletions.
- +36 −0 ...cloud-spanner/src/main/java/com/google/cloud/spanner/AdminRequestsPerMinuteExceededException.java
- +23 −0 google-cloud-spanner/src/main/java/com/google/cloud/spanner/SpannerExceptionFactory.java
- +287 −103 google-cloud-spanner/src/main/java/com/google/cloud/spanner/spi/v1/GapicSpannerRpc.java
- +38 −0 google-cloud-spanner/src/test/java/com/google/cloud/spanner/spi/v1/GapicSpannerRpcTest.java
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,36 @@ | ||
/* | ||
* Copyright 2020 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.google.cloud.spanner; | ||
|
||
import javax.annotation.Nullable; | ||
|
||
/** | ||
* Exception thrown by Cloud Spanner the number of administrative requests per minute has been | ||
* exceeded. | ||
*/ | ||
public class AdminRequestsPerMinuteExceededException extends SpannerException { | ||
private static final long serialVersionUID = -6395746612598975751L; | ||
|
||
static final String ADMIN_REQUESTS_LIMIT_KEY = "quota_limit"; | ||
static final String ADMIN_REQUESTS_LIMIT_VALUE = "AdminMethodQuotaPerMinutePerProject"; | ||
|
||
/** Private constructor. Use {@link SpannerExceptionFactory} to create instances. */ | ||
AdminRequestsPerMinuteExceededException( | ||
DoNotConstructDirectly token, @Nullable String message, @Nullable Throwable cause) { | ||
super(token, ErrorCode.RESOURCE_EXHAUSTED, true, message, cause); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.