refactor(kobo): update book recommendation and initialization resource handling to use entry sets (#870)
This commit is contained in:
@@ -64,8 +64,8 @@ public class KoboInitializationService {
|
|||||||
|
|
||||||
UriComponentsBuilder baseBuilder = koboUrlBuilder.baseBuilder();
|
UriComponentsBuilder baseBuilder = koboUrlBuilder.baseBuilder();
|
||||||
|
|
||||||
for (String name : initializationResources.keySet()) {
|
for (Map.Entry<String, String[]> entry : initializationResources.entrySet()) {
|
||||||
resources.put(name, koboUrlBuilder.withBaseUrl(token, initializationResources.get(name)));
|
resources.put(entry.getKey(), koboUrlBuilder.withBaseUrl(token, entry.getValue()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build extra routes for CDN
|
// Build extra routes for CDN
|
||||||
|
|||||||
@@ -111,9 +111,10 @@ public class BookRecommendationUpdaterTask implements Task {
|
|||||||
Map<Long, Set<BookRecommendationLite>> allRecommendations = new HashMap<>();
|
Map<Long, Set<BookRecommendationLite>> allRecommendations = new HashMap<>();
|
||||||
|
|
||||||
int processedBooks = 0;
|
int processedBooks = 0;
|
||||||
for (Long targetId : allBookIds) {
|
for (Map.Entry<Long, double[]> entry : embeddings.entrySet()) {
|
||||||
|
Long targetId = entry.getKey();
|
||||||
try {
|
try {
|
||||||
double[] targetVector = embeddings.get(targetId);
|
double[] targetVector = entry.getValue();
|
||||||
if (targetVector == null) continue;
|
if (targetVector == null) continue;
|
||||||
|
|
||||||
String targetSeries = seriesNames.get(targetId);
|
String targetSeries = seriesNames.get(targetId);
|
||||||
|
|||||||
Reference in New Issue
Block a user