|
41 | 41 | import com.google.api.core.NanoClock; |
42 | 42 | import com.google.api.gax.retrying.FailingCallable.CustomException; |
43 | 43 | import com.google.api.gax.rpc.testing.FakeCallContext; |
| 44 | + |
| 45 | +import java.util.Optional; |
44 | 46 | import java.util.concurrent.CancellationException; |
45 | 47 | import java.util.concurrent.ExecutionException; |
46 | 48 | import java.util.concurrent.Executors; |
@@ -195,13 +197,13 @@ void testCancelGetAttempt(boolean withCustomRetrySettings) throws Exception { |
195 | 197 | setUp(withCustomRetrySettings); |
196 | 198 | for (int executionsCount = 0; executionsCount < EXECUTIONS_COUNT; executionsCount++) { |
197 | 199 | ScheduledExecutorService localExecutor = Executors.newSingleThreadScheduledExecutor(); |
198 | | - final int maxRetries = 100; |
| 200 | + final int maxRetries = 20; |
199 | 201 |
|
200 | 202 | FailingCallable callable = new FailingCallable(maxRetries - 1, "request", "SUCCESS", tracer); |
201 | 203 | RetrySettings retrySettings = |
202 | 204 | FAST_RETRY_SETTINGS |
203 | 205 | .toBuilder() |
204 | | - .setTotalTimeoutDuration(java.time.Duration.ofMillis(1000L)) |
| 206 | + .setTotalTimeoutDuration(java.time.Duration.ofMillis(5000L)) |
205 | 207 | .setMaxAttempts(maxRetries) |
206 | 208 | .build(); |
207 | 209 |
|
@@ -259,10 +261,10 @@ void testCancelOuterFutureAfterStart() throws Exception { |
259 | 261 | .toBuilder() |
260 | 262 | // These params were selected to ensure that future tries to run and fail (at least |
261 | 263 | // once) but does not complete before it is cancelled. Assuming no computation time, |
262 | | - // it would take 25 + 100 + 400 + 1000 = 1525ms for the future to complete, which should |
| 264 | + // it would take 2500 + 10000 + 10000 + 10000 = 32500ms for the future to complete, which should |
263 | 265 | // be more than enough time to cancel the future. |
264 | | - .setInitialRetryDelayDuration(java.time.Duration.ofMillis(25L)) |
265 | | - .setMaxRetryDelayDuration(java.time.Duration.ofMillis(1000L)) |
| 266 | + .setInitialRetryDelayDuration(java.time.Duration.ofMillis(2500L)) |
| 267 | + .setMaxRetryDelayDuration(java.time.Duration.ofMillis(10000L)) |
266 | 268 | .setRetryDelayMultiplier(4.0) |
267 | 269 | .setTotalTimeoutDuration(java.time.Duration.ofMillis(60000L)) |
268 | 270 | // Set this test to not use jitter as the randomized retry delay (RRD) may introduce |
|
0 commit comments