Compare commits
1 Commits
55ca251f62
...
f955671b8a
| Author | SHA1 | Date | |
|---|---|---|---|
| f955671b8a |
@ -16,6 +16,7 @@ public class MangaContentImageUpdateConsumer {
|
||||
@RabbitListener(queues = "${queues.manga-content-image-update}")
|
||||
public void receiveMangaContentImageUpdateCommand(ImageUpdateCommand command) {
|
||||
log.info("Received manga content image update command: {}", command);
|
||||
|
||||
contentIngestService.updateMangaContentImage(command.entityId(), command.imageId());
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package com.magamochi.content.service;
|
||||
|
||||
import static java.util.Objects.isNull;
|
||||
|
||||
import com.magamochi.catalog.service.LanguageService;
|
||||
import com.magamochi.catalog.service.MangaContentProviderService;
|
||||
import com.magamochi.common.exception.NotFoundException;
|
||||
@ -94,6 +96,11 @@ public class ContentIngestService {
|
||||
|
||||
@Transactional
|
||||
public void updateMangaContentImage(long mangaContentImageId, UUID imageId) {
|
||||
if (isNull(imageId)) {
|
||||
log.error("Null imageID received!");
|
||||
return;
|
||||
}
|
||||
|
||||
var mangaContentImage =
|
||||
mangaContentImageRepository
|
||||
.findById(mangaContentImageId)
|
||||
|
||||
@ -30,7 +30,7 @@ public class ImageFetchService {
|
||||
|
||||
public UUID fetchImage(String imageUrl, ContentType contentType) {
|
||||
try {
|
||||
var request = HttpRequest.newBuilder(URI.create(imageUrl)).GET().build();
|
||||
var request = HttpRequest.newBuilder(URI.create(imageUrl.trim())).GET().build();
|
||||
|
||||
imageDownloadRateLimiter.acquire();
|
||||
var response = httpClient.send(request, HttpResponse.BodyHandlers.ofByteArray());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user