Skip to content

Commit a562875

Browse files
authoredSep 27, 2018
Merge pull request #332 from overture-stack/feature/increase-id-client-retry
added longer default retry for the id client
2 parents 123cc54 + dbd03f3 commit a562875

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed
 

Diff for: ‎song-server/src/main/java/bio/overture/song/server/config/IdConfig.java

+18-1
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@
1717
package bio.overture.song.server.config;
1818

1919
import lombok.Data;
20+
import lombok.val;
2021
import org.icgc.dcc.id.client.core.IdClient;
2122
import org.icgc.dcc.id.client.http.HttpIdClient;
23+
import org.icgc.dcc.id.client.http.webclient.WebClientConfig;
2224
import org.icgc.dcc.id.client.util.HashIdClient;
2325
import org.springframework.boot.context.properties.ConfigurationProperties;
2426
import org.springframework.context.annotation.Bean;
@@ -28,16 +30,31 @@
2830
@Data
2931
@ConfigurationProperties(prefix = "id")
3032
public class IdConfig {
33+
private static final int DEFAULT_MAX_RETRIES = 10;
34+
private static final float DEFAULT_MULTIPLIER = 2;
35+
private static final int DEFAULT_INITIAL_BACKOFF_SECONDS = 2;
3136

3237
private String idUrl;
3338
private String authToken;
3439
private boolean realIds;
3540
private boolean persistInMemory = false;
41+
private int maxRetries = DEFAULT_MAX_RETRIES;
42+
private float multiplier = DEFAULT_MULTIPLIER;
43+
private int initialBackoffSeconds = DEFAULT_INITIAL_BACKOFF_SECONDS;
3644

3745
@Bean
3846
public IdClient createIdClient() {
47+
val idClientConfig = WebClientConfig.builder()
48+
.serviceUrl(idUrl)
49+
.authToken(authToken)
50+
.release("")
51+
.maxRetries(maxRetries)
52+
.retryMultiplier(multiplier)
53+
.waitBeforeRetrySeconds(initialBackoffSeconds)
54+
.build();
55+
3956
// [SONG-167]: Temporarily removed cacheId client due to bug in DCC-ID-12: https://github.com/icgc-dcc/dcc-id/issues/12
40-
return realIds ? new HttpIdClient(idUrl, "", authToken) : new HashIdClient(persistInMemory);
57+
return realIds ? new HttpIdClient(idClientConfig) : new HashIdClient(persistInMemory);
4158
// return realIds ? new CachingIdClient(new HttpIdClient(idUrl, "", authToken)) : new HashIdClient(persistInMemory);
4259
}
4360

Diff for: ‎song-server/src/main/resources/application.yml

+3
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ id:
5555
authToken: "idToken"
5656
realIds: false
5757
persistInMemory: false
58+
maxRetries: 10
59+
multiplier: 2
60+
initialBackoffSeconds: 2
5861

5962
validation:
6063
delayMs: 30

0 commit comments

Comments
 (0)
Please sign in to comment.