Skip to content

Commit ac0bc1f

Browse files
committed
stop retry on rate limit
1 parent 389875f commit ac0bc1f

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Diff for: analytics/src/main/java/com/segment/analytics/internal/AnalyticsClient.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,10 @@ public AnalyticsClient(
138138
.withJitter(.2)
139139
// retry on IOException
140140
.handle(IOException.class)
141-
// retry on 5xx or rate limit
142-
.handleResultIf(response -> is5xx(response.code()) || response.code() == 429)
141+
// retry on 5xx
142+
.handleResultIf(response -> is5xx(response.code()))
143+
// stop retry on rate limit
144+
.abortIf(response -> response.code() == 429)
143145
.build();
144146

145147
this.failsafe = Failsafe.with(retry, breaker).with(networkExecutor);

0 commit comments

Comments
 (0)