summaryrefslogtreecommitdiffstats
path: root/vespaclient-container-plugin
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2022-02-25 13:12:13 +0100
committerHenning Baldersheim <balder@yahoo-inc.com>2022-02-25 13:12:13 +0100
commitd69aeb4ee39c352c87336e617f5d73c58b2faeb8 (patch)
treeece110670f6fbc5eb89ea443a63fce72e1dc0fee /vespaclient-container-plugin
parent1f48f1e0cb904906e18ec220b0a3b21f8676dd27 (diff)
- Use a utility method that recomputes a timeout if VESPA_TIMER_HZ deviates from the default of 1000hz.
Diffstat (limited to 'vespaclient-container-plugin')
-rw-r--r--vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/resource/DocumentV1ApiHandler.java15
1 files changed, 6 insertions, 9 deletions
diff --git a/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/resource/DocumentV1ApiHandler.java b/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/resource/DocumentV1ApiHandler.java
index 4d7c2f1cc14..220c61a3442 100644
--- a/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/resource/DocumentV1ApiHandler.java
+++ b/vespaclient-container-plugin/src/main/java/com/yahoo/document/restapi/resource/DocumentV1ApiHandler.java
@@ -6,6 +6,7 @@ import com.fasterxml.jackson.core.JsonGenerator;
import com.google.inject.Inject;
import com.yahoo.cloud.config.ClusterListConfig;
import com.yahoo.concurrent.DaemonThreadFactory;
+import com.yahoo.concurrent.SystemTimer;
import com.yahoo.container.core.HandlerMetricContextUtil;
import com.yahoo.container.core.documentapi.VespaDocumentAccess;
import com.yahoo.container.jdisc.ContentChannelOutputStream;
@@ -20,7 +21,6 @@ import com.yahoo.document.FixedBucketSpaces;
import com.yahoo.document.TestAndSetCondition;
import com.yahoo.document.config.DocumentmanagerConfig;
import com.yahoo.document.fieldset.AllFields;
-import com.yahoo.document.fieldset.DocumentOnly;
import com.yahoo.document.fieldset.DocIdOnly;
import com.yahoo.document.idstring.IdIdString;
import com.yahoo.document.json.DocumentOperationType;
@@ -212,14 +212,11 @@ public class DocumentV1ApiHandler extends AbstractRequestHandler {
this.asyncSession = access.createAsyncSession(new AsyncParameters());
this.clusters = parseClusters(clusterListConfig, bucketSpacesConfig);
this.operations = new ConcurrentLinkedDeque<>();
- this.dispatcher.scheduleWithFixedDelay(this::dispatchEnqueued,
- executorConfig.resendDelayMillis(),
- executorConfig.resendDelayMillis(),
- MILLISECONDS);
- this.visitDispatcher.scheduleWithFixedDelay(this::dispatchVisitEnqueued,
- executorConfig.resendDelayMillis(),
- executorConfig.resendDelayMillis(),
- MILLISECONDS);
+ int resendDelayMS = SystemTimer.adjustTimeoutByDetectedHz(executorConfig.resendDelayMillis());
+
+ //TODO Here it would be better do have dedicated threads with different wait depending on blocked or empty.
+ this.dispatcher.scheduleWithFixedDelay(this::dispatchEnqueued, resendDelayMS, resendDelayMS, MILLISECONDS);
+ this.visitDispatcher.scheduleWithFixedDelay(this::dispatchVisitEnqueued, resendDelayMS, resendDelayMS, MILLISECONDS);
}
// ------------------------------------------------ Requests -------------------------------------------------