gae: retry on exceptions too, not just on non 200OK (#3885)

This commit is contained in:
zpencer 2017-12-19 16:13:24 -08:00 committed by GitHub
parent cdb911eb5c
commit 73f0fe1eca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 10 deletions

View File

@ -122,13 +122,20 @@ task runInteropTestRemote(dependsOn: 'appengineDeploy') {
// Retry in case GAE is slow and times out
int maxRetries = 5
def result = null
String result = null
Throwable caught = null
for (int attempt = 0; attempt < maxRetries; attempt++) {
result = client.newCall(interopRequest).execute()
if (result.code() == 200) {
try {
def response = client.newCall(interopRequest).execute()
result = response.body().string()
if (response.code() == 200) {
return
}
}
throw new GradleException("Interop test failed: " + result?.body()?.string())
} catch (Throwable t) {
caught = t
logger.log(LogLevel.ERROR, "caught exception. will retry if possible", t)
}
}
throw new GradleException("Interop test failed:\nresponse: ${result}\nthrowable:${caught}")
}
}

View File

@ -129,13 +129,20 @@ task runInteropTestRemote(dependsOn: 'appengineDeploy') {
// Retry in case GAE is slow and times out
int maxRetries = 5
def result = null
String result = null
Throwable caught = null
for (int attempt = 0; attempt < maxRetries; attempt++) {
result = client.newCall(interopRequest).execute()
if (result.code() == 200) {
try {
def response = client.newCall(interopRequest).execute()
result = response.body().string()
if (response.code() == 200) {
return
}
}
throw new GradleException("Interop test failed: " + result?.body()?.string())
} catch (Throwable t) {
caught = t
logger.log(LogLevel.ERROR, "caught exception. will retry if possible", t)
}
}
throw new GradleException("Interop test failed:\nresponse: ${result}\nthrowable:${caught}")
}
}