Release 1.4.4

Fix library scanning by disabling multi-threading (#174)
This commit is contained in:
Simon
2023-11-03 13:43:48 +01:00
committed by GitHub
parent a5bcf0c082
commit 3dcdda27ab
4 changed files with 35 additions and 36 deletions
@@ -96,44 +96,43 @@ public class ImageService {
private int saveImagesIntoCache(MultiValueMap<String, String> entityToImageIds, String imageSize, String imageType, String entityType) { private int saveImagesIntoCache(MultiValueMap<String, String> entityToImageIds, String imageSize, String imageType, String entityType) {
AtomicInteger downloadCounter = new AtomicInteger(); AtomicInteger downloadCounter = new AtomicInteger();
entityToImageIds.entrySet().parallelStream().forEach(entry -> entityToImageIds.forEach((key, value) -> value.forEach(imageId -> {
entry.getValue().forEach(imageId -> {
if (!StringUtils.hasText(imageId)) return; if (!StringUtils.hasText(imageId)) return;
String imgFileName = "%s.png".formatted(imageId); String imgFileName = "%s.png".formatted(imageId);
String imgUrl = "t_%s/%s".formatted(imageSize, imgFileName); String imgUrl = "t_%s/%s".formatted(imageSize, imgFileName);
if (filesystemService.doesCachedFileExist(imgFileName)) { if (filesystemService.doesCachedFileExist(imgFileName)) {
if (filesystemService.isCachedFileCorrupt(imgFileName)) { if (filesystemService.isCachedFileCorrupt(imgFileName)) {
log.info("File '{}' is corrupt, retrying download...", imgFileName); log.info("File '{}' is corrupt, retrying download...", imgFileName);
filesystemService.deleteFileFromCache(imgFileName); filesystemService.deleteFileFromCache(imgFileName);
} else { } else {
log.debug("{} for {} '{}' already downloaded ({}), skipping.", log.debug("{} for {} '{}' already downloaded ({}), skipping.",
imageType.substring(0, 1).toUpperCase() + imageType.substring(1).toLowerCase(), imageType.substring(0, 1).toUpperCase() + imageType.substring(1).toLowerCase(),
entityType, entityType,
entry.getKey(), key,
imgFileName); imgFileName);
return; return;
} }
} }
Flux<DataBuffer> dataBuffer = igdbImageClient.get() Flux<DataBuffer> dataBuffer = igdbImageClient.get()
.uri(imgUrl) .uri(imgUrl)
.retrieve() .retrieve()
.bodyToFlux(DataBuffer.class); .bodyToFlux(DataBuffer.class);
try { try {
filesystemService.saveFileToCache(dataBuffer, imgFileName); filesystemService.saveFileToCache(dataBuffer, imgFileName);
} catch (WebClientResponseException e) { } catch (WebClientResponseException e) {
if (e.getStatusCode().is4xxClientError()) { if (e.getStatusCode().is4xxClientError()) {
log.error("Could not download {} for {} '{}' from {}: {}", imageType, entityType, entry.getKey(), IgdbApiProperties.IMAGES_BASE_URL + imgUrl, e.getStatusCode()); log.error("Could not download {} for {} '{}' from {}: {}", imageType, entityType, key, IgdbApiProperties.IMAGES_BASE_URL + imgUrl, e.getStatusCode());
} }
} }
downloadCounter.getAndIncrement(); downloadCounter.getAndIncrement();
log.info("Downloaded {} for {} '{}' from {}", imageType, entityType, entry.getKey(), IgdbApiProperties.IMAGES_BASE_URL + imgUrl); log.info("Downloaded {} for {} '{}' from {}", imageType, entityType, key, IgdbApiProperties.IMAGES_BASE_URL + imgUrl);
})); }));
return downloadCounter.get(); return downloadCounter.get();
} }
@@ -136,7 +136,7 @@ public class LibraryService {
// For each new game, load the info from IGDB // For each new game, load the info from IGDB
// If a game is not found on IGDB, add it to the list of unmapped files, so we won't query the API later on for the same path // If a game is not found on IGDB, add it to the list of unmapped files, so we won't query the API later on for the same path
// If a game is not found on IGDB, blacklist the path, so we won't query the API later for the same path // If a game is not found on IGDB, blacklist the path, so we won't query the API later for the same path
List<DetectedGame> newDetectedGames = gameFiles.parallelStream() List<DetectedGame> newDetectedGames = gameFiles.stream()
.map(p -> { .map(p -> {
Optional<Igdb.Game> optionalGame = igdbWrapper.searchForGameByTitle(getFilenameWithoutAdditions(p), platformsFilter); Optional<Igdb.Game> optionalGame = igdbWrapper.searchForGameByTitle(getFilenameWithoutAdditions(p), platformsFilter);
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "frontend", "name": "frontend",
"version": "1.4.2-SNAPSHOT", "version": "1.4.4-SNAPSHOT",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "frontend", "name": "frontend",
"version": "1.4.2-SNAPSHOT", "version": "1.4.4-SNAPSHOT",
"dependencies": { "dependencies": {
"@angular/animations": "^16.2.8", "@angular/animations": "^16.2.8",
"@angular/cdk": "^16.2.7", "@angular/cdk": "^16.2.7",
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "frontend", "name": "frontend",
"version": "1.4.2-SNAPSHOT", "version": "1.4.4-SNAPSHOT",
"scripts": { "scripts": {
"ng": "ng", "ng": "ng",
"start": "ng serve", "start": "ng serve",