summaryrefslogtreecommitdiffstats
path: root/vespa-feed-client-api
diff options
context:
space:
mode:
authorjonmv <venstad@gmail.com>2024-05-16 15:31:21 +0200
committerjonmv <venstad@gmail.com>2024-05-16 15:31:21 +0200
commit0c94e0b116f67fc07c9281552b58d9d4c11fd88a (patch)
tree0091288192c2ccc6201d040890ac6e915d222b11 /vespa-feed-client-api
parent975d689861eb5350286f294d79ecf4942f14473a (diff)
Retry requests within retry count limit OR grace period (default 10s)
Diffstat (limited to 'vespa-feed-client-api')
-rw-r--r--vespa-feed-client-api/abi-spec.json3
-rw-r--r--vespa-feed-client-api/src/main/java/ai/vespa/feed/client/FeedClient.java6
2 files changed, 7 insertions, 2 deletions
diff --git a/vespa-feed-client-api/abi-spec.json b/vespa-feed-client-api/abi-spec.json
index 9065edad92a..5248e570d5e 100644
--- a/vespa-feed-client-api/abi-spec.json
+++ b/vespa-feed-client-api/abi-spec.json
@@ -85,7 +85,8 @@
],
"methods" : [
"public boolean retry(ai.vespa.feed.client.FeedClient$OperationType)",
- "public int retries()"
+ "public int retries()",
+ "public java.time.Duration gracePeriod()"
],
"fields" : [ ]
},
diff --git a/vespa-feed-client-api/src/main/java/ai/vespa/feed/client/FeedClient.java b/vespa-feed-client-api/src/main/java/ai/vespa/feed/client/FeedClient.java
index d73d36e0f4e..c45e37c79bb 100644
--- a/vespa-feed-client-api/src/main/java/ai/vespa/feed/client/FeedClient.java
+++ b/vespa-feed-client-api/src/main/java/ai/vespa/feed/client/FeedClient.java
@@ -2,6 +2,7 @@
package ai.vespa.feed.client;
import java.io.Closeable;
+import java.time.Duration;
import java.util.List;
import java.util.concurrent.CompletableFuture;
@@ -74,9 +75,12 @@ public interface FeedClient extends Closeable {
/** Whether to retry operations of the given type. */
default boolean retry(OperationType type) { return true; }
- /** Number of retries per operation for assumed transient, non-backpressure problems. */
+ /** Maximum number of retries per operation for assumed transient, non-backpressure problems. */
default int retries() { return 10; }
+ /** Grace period within which an operation may be retried past its retry count (see {@link #retries}). */
+ default Duration gracePeriod() { return Duration.ofSeconds(10); }
+
}
/** Allows slowing down or halting completely operations against the configured endpoint on high failure rates. */