From 3c1b5755e68771ba84479a4e96d4e3dc0c37307d Mon Sep 17 00:00:00 2001 From: Dmytro Popov Date: Thu, 17 Sep 2020 14:46:27 +0300 Subject: [PATCH] Increase timeout --- descriptors/ModuleDescriptor-template.json | 2 +- src/main/java/org/folio/edge/oaipmh/MainVerticle.java | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/descriptors/ModuleDescriptor-template.json b/descriptors/ModuleDescriptor-template.json index 77cdc11..480d1d6 100644 --- a/descriptors/ModuleDescriptor-template.json +++ b/descriptors/ModuleDescriptor-template.json @@ -28,7 +28,7 @@ }, "env": [ { "name": "JAVA_OPTIONS", - "value": "-XX:MaxRAMPercentage=66.0" + "value": "-XX:MaxRAMPercentage=66.0 -Drequest_timeout_ms=7200000" } ] } diff --git a/src/main/java/org/folio/edge/oaipmh/MainVerticle.java b/src/main/java/org/folio/edge/oaipmh/MainVerticle.java index faff2a6..395538f 100644 --- a/src/main/java/org/folio/edge/oaipmh/MainVerticle.java +++ b/src/main/java/org/folio/edge/oaipmh/MainVerticle.java @@ -17,6 +17,12 @@ public class MainVerticle extends EdgeVerticle2 { public Router defineRoutes() { String okapiURL = config().getString(SYS_OKAPI_URL); int reqTimeoutMs = config().getInteger(SYS_REQUEST_TIMEOUT_MS); + // first call to mod-oai-pmh is supposed to take significant time + // if the timeout is not set via env vars, it will be 2 hours + if (reqTimeoutMs == Constants.DEFAULT_REQUEST_TIMEOUT_MS) { + reqTimeoutMs = 7200000; + } + OaiPmhOkapiClientFactory ocf = new OaiPmhOkapiClientFactory(vertx, okapiURL, reqTimeoutMs); OaiPmhHandler oaiPmhHandler = new OaiPmhHandler(secureStore, ocf);