Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Open Subsurface Data Universe Software
Platform
System
Indexer
Commits
ac64cbf9
Commit
ac64cbf9
authored
Oct 01, 2021
by
neelesh thakur
Browse files
Merge branch 'retry-exponential' into 'master'
switch to exponential backoff instead of fixed interval See merge request
!207
parents
5510fa6b
da5d2c0d
Pipeline
#76413
passed with stages
in 29 minutes and 56 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
provider/indexer-azure/src/main/java/org/opengroup/osdu/indexer/azure/service/RetryPolicy.java
View file @
ac64cbf9
...
...
@@ -18,6 +18,7 @@ import com.google.gson.JsonArray;
import
com.google.gson.JsonElement
;
import
com.google.gson.JsonObject
;
import
com.google.gson.JsonParser
;
import
io.github.resilience4j.core.IntervalFunction
;
import
io.github.resilience4j.retry.RetryConfig
;
import
lombok.Data
;
import
lombok.extern.java.Log
;
...
...
@@ -27,7 +28,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.stereotype.Component
;
import
java.time.Duration
;
import
java.util.function.Predicate
;
/**
...
...
@@ -44,8 +44,8 @@ public class RetryPolicy {
@Autowired
private
JaxRsDpsLog
logger
;
private
int
attempts
=
3
;
private
int
waitDuration
=
1000
;
private
static
int
MAX_ATTEMPTS
=
5
;
private
static
int
INITIAL_DELAY
=
1000
;
private
final
String
RECORD_NOT_FOUND
=
"notFound"
;
/**
...
...
@@ -53,8 +53,8 @@ public class RetryPolicy {
*/
public
RetryConfig
retryConfig
(
Predicate
<
HttpResponse
>
predicate
)
{
return
RetryConfig
.<
HttpResponse
>
custom
()
.
maxAttempts
(
attempts
)
.
waitDuration
(
Duration
.
ofMillis
(
waitDuration
))
.
maxAttempts
(
MAX_ATTEMPTS
)
.
intervalFunction
(
IntervalFunction
.
ofExponentialBackoff
(
INITIAL_DELAY
,
2
))
.
retryOnResult
(
predicate
)
.
build
();
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment