Index: branches/APG_ES_Product/Java/nsight-product-availability/src/main/java/com/genpt/nsight/v4/service/impl/ProductAvailabilityDetailServiceV4Impl.java =================================================================== diff -u -r254959 -r255313 --- branches/APG_ES_Product/Java/nsight-product-availability/src/main/java/com/genpt/nsight/v4/service/impl/ProductAvailabilityDetailServiceV4Impl.java (.../ProductAvailabilityDetailServiceV4Impl.java) (revision 254959) +++ branches/APG_ES_Product/Java/nsight-product-availability/src/main/java/com/genpt/nsight/v4/service/impl/ProductAvailabilityDetailServiceV4Impl.java (.../ProductAvailabilityDetailServiceV4Impl.java) (revision 255313) @@ -155,10 +155,12 @@ || nSightCache.getInvDataSvcPilotStores().toUpperCase().contains(pilotLocationPrefixAll.toUpperCase()) || nSightCache.getInvDataSvcPilotStores().toUpperCase().contains(pilotLocation.get().toUpperCase())) && availabilityServiceContextV3.getPartSet().size() <= partCountCallToGCP); - //make calls to nsight irrespective - inventoryServiceV2.setInventoryFutures(availabilityServiceContextV3); - LOGGER.debug( - splunkLogger.toString() + " Submitted NSight Queries in {} ms", (System.currentTimeMillis() - queryStartTime)); + //make calls to nsight only if data from nsight is required + if(isEnableCompare() || !isGCPRequestNeeded || !pilotSellingChannelsResponseFromGcp){ + inventoryServiceV2.setInventoryFutures(availabilityServiceContextV3); + LOGGER.debug( + splunkLogger.toString() + " Submitted NSight Queries in {} ms", (System.currentTimeMillis() - queryStartTime)); + } if (isGCPRequestNeeded) { //calls goto GCP either to single part endpoint or multipart if(useMultiProductEndpoint){ @@ -174,8 +176,11 @@ long invResponseProcessingStartTime = System.currentTimeMillis(); //Set if we should or not use the hqline abbrev logic setSkipHQLineAbbrev(availabilityServiceContextV3); - Map> nsightInventoryMap = inventoryServiceV2.processInventoryFutures(availabilityServiceContextV3); - LOGGER.debug(splunkLogger.toString() + " Processed NSight Inventory Query Response in {} ms", (System.currentTimeMillis() - invResponseProcessingStartTime)); + Map> nsightInventoryMap = null; + if(isEnableCompare() || !isGCPRequestNeeded || !pilotSellingChannelsResponseFromGcp){ + nsightInventoryMap = inventoryServiceV2.processInventoryFutures(availabilityServiceContextV3); + LOGGER.info(splunkLogger.toString() + " Processed NSight Inventory Query Response in {} ms", (System.currentTimeMillis() - invResponseProcessingStartTime)); + } //we will process the GCP responses asynchronously try { if(gcpResponseFutures!=null && !useMultiProductEndpoint) { @@ -234,7 +239,7 @@ availabilityServiceContextV3.getSitesWithInventory().clear(); if(pilotSellingChannelsResponseFromGcp){// need the data from GCP in final response Map> gcpInventoryMap = - asyncInventoryComparator.getGCPInventoryMultiProduct(ImmutableMap.copyOf(availabilityServiceContextV3.getInventory()), gcpResponseFutures, availabilityServiceContextV3.getRequest()); + asyncInventoryComparator.getGCPInventoryMultiProduct(gcpResponseFutures, availabilityServiceContextV3.getRequest()); if(gcpInventoryMap==null) gcpInventoryMap = new HashMap<>(); availabilityServiceContextV3.setGcpInventory(gcpInventoryMap);