Fix error if one of the file transformer clients doesn't respond

This commit is contained in:
George Kalampokis 2024-01-26 12:54:55 +02:00
parent 447059530d
commit c9121ebb1a
1 changed files with 11 additions and 3 deletions

View File

@ -110,13 +110,21 @@ public class FileTransformerService {
//GK: So much for lazy loading
List<TransformerRepository> repositories = transformerProperties.getSources().stream().map(depositSource -> getRepository(depositSource.getCodes().get(0))).toList();
repositories = new ArrayList<>(repositories);
List<TransformerRepository> toDelete = new ArrayList<>();
repositories.forEach((client) -> {
try {
FileTransformerConfiguration repositoryConfigs = client.getConfiguration();
if (repositoryConfigs != null && !repositoryConfigs.getExportVariants().isEmpty()) {
configurations.addAll(repositoryConfigs.getExportVariants());
}
} catch (Exception e) {
toDelete.add(client);
}
});
repositories.removeAll(toDelete);
configs = new TransformerCacheModel(configurations);
this.fileTransformerConfigurationCache.put("base", configs);
}