From 1519fc1ac11667fb2efa47d610f98311cf38b1e6 Mon Sep 17 00:00:00 2001 From: qGYdXbY2 <47661341+qGYdXbY2@users.noreply.github.com> Date: Fri, 6 Dec 2024 11:52:08 +0100 Subject: [PATCH] loadSpaceStatistics - explicit EXTENSION Signed-off-by: qGYdXbY2 <47661341+qGYdXbY2@users.noreply.github.com> --- .../com/here/xyz/jobs/steps/compiler/SpaceCopy.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/xyz-jobs/xyz-job-service/src/main/java/com/here/xyz/jobs/steps/compiler/SpaceCopy.java b/xyz-jobs/xyz-job-service/src/main/java/com/here/xyz/jobs/steps/compiler/SpaceCopy.java index 31a1e51fd..fa8bd9dbd 100644 --- a/xyz-jobs/xyz-job-service/src/main/java/com/here/xyz/jobs/steps/compiler/SpaceCopy.java +++ b/xyz-jobs/xyz-job-service/src/main/java/com/here/xyz/jobs/steps/compiler/SpaceCopy.java @@ -35,6 +35,7 @@ import com.here.xyz.jobs.steps.impl.transport.CopySpacePre; import com.here.xyz.jobs.steps.impl.transport.CopySpacePost; import com.here.xyz.models.hub.Ref; +import com.here.xyz.models.hub.Space; import com.here.xyz.responses.StatisticsResponse; import com.here.xyz.util.web.HubWebClient; import com.here.xyz.util.web.XyzWebClient.WebClientException; @@ -64,6 +65,14 @@ private static int threadCountCalc( long sourceFeatureCount, long targetFeatureC return PARALLELIZTATION_THREAD_MAX; } + + private static StatisticsResponse _loadSpaceStatistics(String spaceId) throws WebClientException + { + Space sourceSpace = HubWebClient.getInstance(Config.instance.HUB_ENDPOINT).loadSpace(spaceId); + boolean isExtended = sourceSpace.getExtension() != null; + return HubWebClient.getInstance(Config.instance.HUB_ENDPOINT).loadSpaceStatistics(spaceId, isExtended ? SpaceContext.EXTENSION : null); + } + public static CompilationStepGraph compileSteps(String sourceId, String targetId, String jobId, Filters filters, Ref versionRef) { final String sourceSpaceId = sourceId, @@ -71,8 +80,8 @@ public static CompilationStepGraph compileSteps(String sourceId, String targetId StatisticsResponse sourceStatistics = null, targetStatistics = null; try { - sourceStatistics = HubWebClient.getInstance(Config.instance.HUB_ENDPOINT).loadSpaceStatistics(sourceSpaceId,SpaceContext.EXTENSION); - targetStatistics = HubWebClient.getInstance(Config.instance.HUB_ENDPOINT).loadSpaceStatistics(targetSpaceId,SpaceContext.EXTENSION); + sourceStatistics = _loadSpaceStatistics(sourceSpaceId); + targetStatistics = _loadSpaceStatistics(targetSpaceId); } catch (WebClientException e) { String errMsg = String.format("Unable to get Staistics for %s", sourceStatistics == null ? sourceSpaceId : targetSpaceId ); throw new JobCompiler.CompilationError(errMsg);