Skip to content

Commit

Permalink
MODSOURMAN-712. Timeout when importing MARC files. Fixing http timeou…
Browse files Browse the repository at this point in the history
…ts (#490)

(cherry picked from commit 3c324ee)
  • Loading branch information
SerhiiNosko authored and KaterynaSenchenko committed Mar 25, 2022
1 parent 21a8e8b commit 5dc3490
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,12 @@
import io.vertx.core.Future;
import io.vertx.core.Promise;
import io.vertx.core.http.HttpClient;
import io.vertx.core.http.HttpClientOptions;
import io.vertx.core.json.JsonObject;

public class DataImportConsumerVerticle extends AbstractVerticle {

private static final Logger LOGGER = LogManager.getLogger(DataImportConsumerVerticle.class);

private static final int DEFAULT_HTTP_TIMEOUT_IN_MILLISECONDS = 3000;

private static final List<DataImportEventTypes> EVENT_TYPES = List.of(
DI_INVENTORY_HOLDING_CREATED,
DI_INVENTORY_HOLDING_MATCHED,
Expand Down Expand Up @@ -108,8 +105,7 @@ public void start(Promise<Void> startPromise) {
LOGGER.info(format("kafkaConfig: %s", kafkaConfig));
EventManager.registerKafkaEventPublisher(kafkaConfig, vertx, maxDistributionNumber);

HttpClientOptions params = new HttpClientOptions().setConnectTimeout(DEFAULT_HTTP_TIMEOUT_IN_MILLISECONDS);
HttpClient client = vertx.createHttpClient(params);
HttpClient client = vertx.createHttpClient();
Storage storage = Storage.basedUpon(vertx, config, client);

String profileSnapshotExpirationTime = getCacheEnvVariable(config, "inventory.profile-snapshot-cache.expiration.time.seconds");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@

import io.vertx.core.Future;
import io.vertx.core.Vertx;
import io.vertx.core.http.HttpClientOptions;
import io.vertx.core.json.Json;
import io.vertx.ext.unit.Async;
import io.vertx.ext.unit.TestContext;
Expand All @@ -39,7 +38,7 @@ public class JobProfileSnapshotCacheTest {

private final Vertx vertx = Vertx.vertx();
private final ProfileSnapshotCache profileSnapshotCache = new ProfileSnapshotCache(vertx,
vertx.createHttpClient(new HttpClientOptions().setConnectTimeout(3000)), 3600);
vertx.createHttpClient(), 3600);

@Rule
public WireMockRule mockServer = new WireMockRule(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@

import io.vertx.core.Future;
import io.vertx.core.Vertx;
import io.vertx.core.http.HttpClientOptions;
import io.vertx.core.json.Json;
import io.vertx.ext.unit.Async;
import io.vertx.ext.unit.TestContext;
Expand All @@ -36,7 +35,7 @@ public class MappingMetadataCacheTest {

private final Vertx vertx = Vertx.vertx();
private final MappingMetadataCache mappingMetadataCache = new MappingMetadataCache(vertx,
vertx.createHttpClient(new HttpClientOptions().setConnectTimeout(3000)), 3600);
vertx.createHttpClient(), 3600);

@Rule
public WireMockRule mockServer = new WireMockRule(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import io.vertx.core.Future;
import io.vertx.core.Vertx;
import io.vertx.core.http.HttpClient;
import io.vertx.core.http.HttpClientOptions;
import io.vertx.core.json.Json;
import io.vertx.core.json.JsonObject;
import io.vertx.ext.unit.Async;
Expand Down Expand Up @@ -133,7 +132,7 @@ public void setUp() {
.maxRequestSize(1048576)
.build();

HttpClient client = vertx.createHttpClient(new HttpClientOptions().setConnectTimeout(3000));
HttpClient client = vertx.createHttpClient();
dataImportKafkaHandler = new DataImportKafkaHandler(vertx, mockedStorage, client,
new ProfileSnapshotCache(vertx, client, 3600),
kafkaConfig, new MappingMetadataCache(vertx, client, 3600));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

import io.vertx.core.Future;
import io.vertx.core.Vertx;
import io.vertx.core.http.HttpClientOptions;
import io.vertx.core.json.Json;
import io.vertx.core.json.JsonObject;
import org.apache.http.HttpStatus;
Expand Down Expand Up @@ -169,7 +168,7 @@ public void setUp() throws IOException {
Vertx vertx = Vertx.vertx();
createInstanceEventHandler = new CreateInstanceEventHandler(storage,
new PrecedingSucceedingTitlesHelper(context -> mockedClient), new MappingMetadataCache(vertx,
vertx.createHttpClient(new HttpClientOptions().setConnectTimeout(3000)), 3600),
vertx.createHttpClient(), 3600),
instanceIdStorageService);


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@
import com.google.common.collect.Lists;

import io.vertx.core.Vertx;
import io.vertx.core.http.HttpClientOptions;
import io.vertx.core.json.Json;
import io.vertx.core.json.JsonArray;
import io.vertx.core.json.JsonObject;
import scala.concurrent.Promise;

import org.apache.http.HttpStatus;
import org.folio.ActionProfile;
Expand Down Expand Up @@ -90,7 +88,6 @@
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.atLeast;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
Expand Down Expand Up @@ -178,7 +175,7 @@ public void setUp() throws IOException {

Vertx vertx = Vertx.vertx();
replaceInstanceEventHandler = new ReplaceInstanceEventHandler(storage, precedingSucceedingTitlesHelper, new MappingMetadataCache(vertx,
vertx.createHttpClient(new HttpClientOptions().setConnectTimeout(3000)), 3600));
vertx.createHttpClient(), 3600));


doAnswer(invocationOnMock -> {
Expand Down

0 comments on commit 5dc3490

Please sign in to comment.