Skip to content

Commit b43648e

Browse files
committed
fix per reviews
1 parent d7b9237 commit b43648e

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

android-sdk/src/main/java/com/optimizely/ab/android/sdk/cmab/DefaultCmabClient.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ open class DefaultCmabClient : CmabClient {
135135

136136
// the numerical base for the exponential backoff (1 second)
137137
const val REQUEST_BACKOFF_TIMEOUT = 1
138-
// retry twice = 3 total attempts
139-
const val REQUEST_RETRIES_POWER = 2
138+
// retry once = 2 total attempts
139+
const val REQUEST_RETRIES_POWER = 1
140140
}
141141
}

shared/src/main/java/com/optimizely/ab/android/shared/Client.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,14 +171,14 @@ public <T> T execute(Request<T> request, int timeout, int power) {
171171
// don't sleep if this was the last attempt
172172
if (attempts >= maxAttempts) break;
173173

174+
timeout = (int) Math.pow(baseTimeout, attempts);
174175
try {
175176
logger.info("Request failed, waiting {} seconds to try again", timeout);
176177
Thread.sleep(TimeUnit.MILLISECONDS.convert(timeout, TimeUnit.SECONDS));
177178
} catch (InterruptedException e) {
178179
logger.warn("Exponential backoff failed", e);
179180
break;
180181
}
181-
timeout = timeout * baseTimeout;
182182
} else {
183183
break;
184184
}

0 commit comments

Comments
 (0)