@@ -133,6 +133,7 @@ public class UIDOperatorVerticle extends AbstractVerticle {
133133 public static final long OPT_OUT_CHECK_CUTOFF_DATE = Instant .parse ("2023-09-01T00:00:00.00Z" ).getEpochSecond ();
134134 private final Handler <Boolean > saltRetrievalResponseHandler ;
135135 private final int allowClockSkewSeconds ;
136+ private final ComputePoolService computePoolService ;
136137 protected Map <Integer , Set <String >> siteIdToInvalidOriginsAndAppNames = new HashMap <>();
137138 protected boolean keySharingEndpointProvideAppNames ;
138139 protected Instant lastInvalidOriginProcessTime = Instant .now ();
@@ -164,7 +165,8 @@ public UIDOperatorVerticle(IConfigStore configStore,
164165 IStatsCollectorQueue statsCollectorQueue ,
165166 SecureLinkValidatorService secureLinkValidatorService ,
166167 Handler <Boolean > saltRetrievalResponseHandler ,
167- UidInstanceIdProvider uidInstanceIdProvider ) {
168+ UidInstanceIdProvider uidInstanceIdProvider ,
169+ ComputePoolService computePoolService ) {
168170 this .keyManager = keyManager ;
169171 this .secureLinkValidatorService = secureLinkValidatorService ;
170172 try {
@@ -198,6 +200,7 @@ public UIDOperatorVerticle(IConfigStore configStore,
198200 this .identityV3Enabled = config .getBoolean (IdentityV3Prop , false );
199201 this .disableOptoutToken = config .getBoolean (DisableOptoutTokenProp , false );
200202 this .uidInstanceIdProvider = uidInstanceIdProvider ;
203+ this .computePoolService = computePoolService ;
201204 }
202205
203206 @ Override
@@ -283,9 +286,9 @@ private void setUpEncryptedRoutes(Router mainRouter, BodyHandler bodyHandler) {
283286 mainRouter .post (V2_TOKEN_VALIDATE .toString ()).handler (bodyHandler ).handler (auth .handleV1 (
284287 rc -> encryptedPayloadHandler .handle (rc , this ::handleTokenValidateV2 ), Role .GENERATOR ));
285288 mainRouter .post (V2_IDENTITY_BUCKETS .toString ()).handler (bodyHandler ).handler (auth .handleV1 (
286- rc -> encryptedPayloadHandler .handle (rc , this ::handleBucketsV2 ), Role .MAPPER ));
289+ rc -> encryptedPayloadHandler .handleAsync (rc , this ::handleBucketsV2Async ), Role .MAPPER ));
287290 mainRouter .post (V2_IDENTITY_MAP .toString ()).handler (bodyHandler ).handler (auth .handleV1 (
288- rc -> encryptedPayloadHandler .handle (rc , this ::handleIdentityMapV2 ), Role .MAPPER ));
291+ rc -> encryptedPayloadHandler .handleAsync (rc , this ::handleIdentityMapV2Async ), Role .MAPPER ));
289292 mainRouter .post (V2_KEY_LATEST .toString ()).handler (bodyHandler ).handler (auth .handleV1 (
290293 rc -> encryptedPayloadHandler .handle (rc , this ::handleKeysRequestV2 ), Role .ID_READER ));
291294 mainRouter .post (V2_KEY_SHARING .toString ()).handler (bodyHandler ).handler (auth .handleV1 (
@@ -304,7 +307,7 @@ private void setUpEncryptedRoutes(Router mainRouter, BodyHandler bodyHandler) {
304307 mainRouter .post (V2_TOKEN_CLIENTGENERATE .toString ()).handler (bodyHandler ).handler (this ::handleClientSideTokenGenerate );
305308
306309 mainRouter .post (V3_IDENTITY_MAP .toString ()).handler (bodyHandler ).handler (auth .handleV1 (
307- rc -> encryptedPayloadHandler .handle (rc , this ::handleIdentityMapV3 ), Role .MAPPER ));
310+ rc -> encryptedPayloadHandler .handleAsync (rc , this ::handleIdentityMapV3Async ), Role .MAPPER ));
308311 }
309312
310313 private void handleClientSideTokenGenerate (RoutingContext rc ) {
@@ -1037,6 +1040,12 @@ private Future handleLogoutAsyncV2(RoutingContext rc) {
10371040 }
10381041 }
10391042
1043+ private Future <Void > handleBucketsV2Async (RoutingContext rc ) {
1044+ return computePoolService .executeBlocking (() -> {
1045+ handleBucketsV2 (rc );
1046+ });
1047+ }
1048+
10401049 private void handleBucketsV2 (RoutingContext rc ) {
10411050 final JsonObject req = (JsonObject ) rc .data ().get ("request" );
10421051 final String qp = req .getString ("since_timestamp" );
@@ -1222,6 +1231,12 @@ private boolean validateServiceLink(RoutingContext rc) {
12221231 return false ;
12231232 }
12241233
1234+ private Future <Void > handleIdentityMapV2Async (RoutingContext rc ) {
1235+ return computePoolService .executeBlocking (() -> {
1236+ handleIdentityMapV2 (rc );
1237+ });
1238+ }
1239+
12251240 private void handleIdentityMapV2 (RoutingContext rc ) {
12261241 try {
12271242 final Integer siteId = RoutingContextUtil .getSiteId (rc );
@@ -1285,6 +1300,12 @@ private InputUtil.InputVal[] getIdentityMapV2Input(RoutingContext rc) {
12851300 getInputList .get ();
12861301 }
12871302
1303+ private Future <Void > handleIdentityMapV3Async (RoutingContext rc ) {
1304+ return computePoolService .executeBlocking (() -> {
1305+ handleIdentityMapV3 (rc );
1306+ });
1307+ }
1308+
12881309 private void handleIdentityMapV3 (RoutingContext rc ) {
12891310 try {
12901311 JsonObject jsonInput = (JsonObject ) rc .data ().get ("request" );
0 commit comments