Skip to content

Commit

Permalink
Merge pull request #1028 from eclipse-tractusx/fix/pool-orch-communic…
Browse files Browse the repository at this point in the history
…ation

fix(Pool): sending too long error messages to the Orchestrator
  • Loading branch information
nicoprow authored Aug 12, 2024
2 parents 6ad0813 + 6fa084b commit 567692d
Showing 1 changed file with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,21 @@ class TaskStepFetchAndReserveService(

if (taskStepReservation.reservedTasks.isNotEmpty()) {
val taskResults = upsertGoldenRecordIntoPool(taskStepReservation.reservedTasks)
orchestrationClient.goldenRecordTasks.resolveStepResults(TaskStepResultRequest(step = TaskStep.PoolSync, results = taskResults))

//Limit the length of errors so for the Orchestrator to not reject it
val resultsWithSafeErrors = taskResults.map { result ->
result.copy(errors = result.errors.map { error ->
error.copy(description = error.description.take(250))
})
}
try{
orchestrationClient.goldenRecordTasks.resolveStepResults(TaskStepResultRequest(step = TaskStep.PoolSync, results = resultsWithSafeErrors))
}catch (e: Throwable){
logger.error { "Some unexpected problem on the orchestrator side. Try to resolve the current tasks with generic exceptions to at least get them out of the reserved state" }
val genericErrorResults = resultsWithSafeErrors.map { TaskStepResultEntryDto(it.taskId, BusinessPartner.empty, listOf(TaskErrorDto(TaskErrorType.Unspecified, "Unknown exception when communicating with the golden record process"))) }
orchestrationClient.goldenRecordTasks.resolveStepResults(TaskStepResultRequest(step = TaskStep.PoolSync, results = genericErrorResults ))
}

}
logger.info { "Cleaning tasks processing completed for this iteration." }

Expand Down

0 comments on commit 567692d

Please sign in to comment.