refactor(kobo): update book recommendation and initialization resource handling to use entry sets (#870)

This commit is contained in:
brios
2026-04-25 18:37:20 +02:00
committed by GitHub
parent 3fda81b539
commit e7bc5fef94
2 changed files with 5 additions and 4 deletions
@@ -64,8 +64,8 @@ public class KoboInitializationService {
UriComponentsBuilder baseBuilder = koboUrlBuilder.baseBuilder();
for (String name : initializationResources.keySet()) {
resources.put(name, koboUrlBuilder.withBaseUrl(token, initializationResources.get(name)));
for (Map.Entry<String, String[]> entry : initializationResources.entrySet()) {
resources.put(entry.getKey(), koboUrlBuilder.withBaseUrl(token, entry.getValue()));
}
// Build extra routes for CDN
@@ -111,9 +111,10 @@ public class BookRecommendationUpdaterTask implements Task {
Map<Long, Set<BookRecommendationLite>> allRecommendations = new HashMap<>();
int processedBooks = 0;
for (Long targetId : allBookIds) {
for (Map.Entry<Long, double[]> entry : embeddings.entrySet()) {
Long targetId = entry.getKey();
try {
double[] targetVector = embeddings.get(targetId);
double[] targetVector = entry.getValue();
if (targetVector == null) continue;
String targetSeries = seriesNames.get(targetId);