dev add utf encoding
Test Workflow / test (push) Successful in 3s

This commit is contained in:
vladp
2026-02-10 13:47:08 +07:00
parent 86f7fc593a
commit bf48725244
2 changed files with 2 additions and 5 deletions
@@ -63,7 +63,8 @@ public class ImageFoundRequestHandler implements RequestHandler {
String yandexReverseSearchResponse;
try {
yandexReverseSearchResponse = yandexSearchService.searchReverseByPublicUrlWithTimeout(fileEntity, 20);
yandexReverseSearchResponse = yandexSearchService.searchReverseByPublicUrlWithTimeout(fileEntity,
20);
} catch (TimeoutException e) {
log.warn("Search timeout for file {}, returning empty results", fileId);
return new BaseResponse(request.getMsgId(), MessageCode.SUCCESS.getCode(),
@@ -209,7 +209,6 @@ public class YandexSearchService {
public String searchReverseByPublicUrlWithTimeout(FileEntity fileEntity, int timeoutSeconds)
throws IOException, TimeoutException {
if (!isImageFile(fileEntity)) {
log.error("File not image: {}", fileEntity.getMimeType());
throw new NotValidFieldException("File not image", new BaseResponse(20007,
@@ -220,16 +219,13 @@ public class YandexSearchService {
String publicUrl = String.format("%s/api/files/public/%s", appBaseUrl, fileEntity.getId());
log.info("Searching reverse for image: {}", publicUrl);
// Создаем ExecutorService с одним потоком
ExecutorService executor = Executors.newSingleThreadExecutor();
try {
// Запускаем задачу с таймаутом
Future<String> future = executor.submit(() ->
callReverseImageApiByUrlWithTimeout(publicUrl, timeoutSeconds)
);
// Получаем результат с таймаутом
return future.get(timeoutSeconds, TimeUnit.SECONDS);
} catch (TimeoutException e) {