diff --git a/apps/api-runtime/src/main/java/com/akto/runtime/APICatalogSync.java b/apps/api-runtime/src/main/java/com/akto/runtime/APICatalogSync.java index f3375697dc..224ba11448 100644 --- a/apps/api-runtime/src/main/java/com/akto/runtime/APICatalogSync.java +++ b/apps/api-runtime/src/main/java/com/akto/runtime/APICatalogSync.java @@ -49,7 +49,6 @@ public class APICatalogSync { public Map delta; public AktoPolicyNew aktoPolicyNew; public Map sensitiveParamInfoBooleanMap; - public static boolean mergeAsyncOutside = true; public APICatalogSync(String userIdentifier,int thresh, boolean fetchAllSTI) { this.thresh = thresh; @@ -185,7 +184,7 @@ public void computeDelta(URLAggregator origAggregator, boolean triggerTemplateGe aktoPolicyNew.process(responseParams); } catch (Exception e) { e.printStackTrace(); - throw new RuntimeException(e); + loggerMaker.errorAndAddToDb("Error while processing aktoPolicyNew for" + responseParams.getRequestParams().getURL() +" : " + e.getMessage(), LogDb.RUNTIME); } } } @@ -199,18 +198,13 @@ public void computeDelta(URLAggregator origAggregator, boolean triggerTemplateGe start = System.currentTimeMillis(); tryWithKnownURLTemplates(pendingRequests, deltaCatalog, dbCatalog, apiCollectionId ); - if (!mergeAsyncOutside) { - start = System.currentTimeMillis(); - tryMergingWithKnownStrictURLs(pendingRequests, dbCatalog, deltaCatalog); - } else { - for (URLStatic pending: pendingRequests.keySet()) { - RequestTemplate pendingTemplate = pendingRequests.get(pending); - RequestTemplate rt = deltaCatalog.getStrictURLToMethods().get(pending); - if (rt != null) { - rt.mergeFrom(pendingTemplate); - } else { - deltaCatalog.getStrictURLToMethods().put(pending, pendingTemplate); - } + for (URLStatic pending: pendingRequests.keySet()) { + RequestTemplate pendingTemplate = pendingRequests.get(pending); + RequestTemplate rt = deltaCatalog.getStrictURLToMethods().get(pending); + if (rt != null) { + rt.mergeFrom(pendingTemplate); + } else { + deltaCatalog.getStrictURLToMethods().put(pending, pendingTemplate); } } } @@ -1217,7 +1211,7 @@ public void buildFromDB(boolean calcDiff, boolean fetchAllSTI) { loggerMaker.infoAndAddToDb("Started building from dB", LogDb.RUNTIME); boolean mergingCalled = false; - if (mergeAsyncOutside && fetchAllSTI ) { + if (fetchAllSTI ) { if (Context.now() - lastMergeAsyncOutsideTs > 600) { this.lastMergeAsyncOutsideTs = Context.now(); @@ -1271,9 +1265,7 @@ public void buildFromDB(boolean calcDiff, boolean fetchAllSTI) { this.sensitiveParamInfoBooleanMap.put(sensitiveParamInfo, false); } - if (mergeAsyncOutside) { - this.delta = new HashMap<>(); - } + this.delta = new HashMap<>(); try {