Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.uid2</groupId>
<artifactId>uid2-operator</artifactId>
<version>5.53.6</version>
<version>5.53.7-alpha-191-SNAPSHOT</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
1 change: 1 addition & 0 deletions src/main/java/com/uid2/operator/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,7 @@ private static Vertx createVertx() {

VertxOptions vertxOptions = new VertxOptions()
.setMetricsOptions(metricOptions)
.setWorkerPoolSize(10000)
.setBlockedThreadCheckInterval(threadBlockedCheckInterval);

return Vertx.vertx(vertxOptions);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ private void setUpEncryptedRoutes(Router mainRouter, BodyHandler bodyHandler) {
mainRouter.post(V2_IDENTITY_BUCKETS.toString()).handler(bodyHandler).handler(auth.handleV1(
rc -> encryptedPayloadHandler.handle(rc, this::handleBucketsV2), Role.MAPPER));
mainRouter.post(V2_IDENTITY_MAP.toString()).handler(bodyHandler).handler(auth.handleV1(
rc -> encryptedPayloadHandler.handle(rc, this::handleIdentityMapV2), Role.MAPPER));
rc -> encryptedPayloadHandler.handleNonBlocking(vertx, rc, this::handleIdentityMapV2), Role.MAPPER));
mainRouter.post(V2_KEY_LATEST.toString()).handler(bodyHandler).handler(auth.handleV1(
rc -> encryptedPayloadHandler.handle(rc, this::handleKeysRequestV2), Role.ID_READER));
mainRouter.post(V2_KEY_SHARING.toString()).handler(bodyHandler).handler(auth.handleV1(
Expand Down
26 changes: 26 additions & 0 deletions src/main/java/com/uid2/operator/vertx/V2PayloadHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import com.uid2.shared.store.ISiteStore;
import io.vertx.core.Future;
import io.vertx.core.Handler;
import io.vertx.core.Vertx;
import io.vertx.core.buffer.Buffer;
import io.vertx.core.http.HttpHeaders;
import io.vertx.core.json.JsonObject;
Expand Down Expand Up @@ -61,6 +62,31 @@ public void handle(RoutingContext rc, Handler<RoutingContext> apiHandler) {
handleResponse(rc, request);
}

public void handleNonBlocking(Vertx vertx, RoutingContext rc, Handler<RoutingContext> apiHandler) {
vertx.executeBlocking(
blockingPromise -> {
V2RequestUtil.V2Request request = V2RequestUtil.parseRequest(rc.body().asString(), AuthMiddleware.getAuthClient(ClientKey.class, rc), new InstantClock());
if (!request.isValid()) {
ResponseUtil.LogInfoAndSend400Response(rc, request.errorMessage);
blockingPromise.complete();
return;
}
rc.data().put("request", request.payload);

apiHandler.handle(rc);

handleResponse(rc, request);
blockingPromise.complete(request);
},
false,
blockingResult -> {
if (blockingResult.failed()) {
ResponseUtil.LogErrorAndSendResponse(ResponseUtil.ResponseStatus.GenericError, 500, rc, "");
}
});

}

public void handleAsync(RoutingContext rc, Function<RoutingContext, Future> apiHandler) {
if (!enableEncryption) {
apiHandler.apply(rc);
Expand Down