fix
This commit is contained in:
@@ -13,6 +13,8 @@ import kz.konturai.parser.repository.MarketingAnalysisV3Repository;
|
|||||||
import kz.konturai.parser.repository.MarketingStrategyRepository;
|
import kz.konturai.parser.repository.MarketingStrategyRepository;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.scheduling.annotation.Async;
|
import org.springframework.scheduling.annotation.Async;
|
||||||
@@ -36,6 +38,11 @@ public class MarketingStrategyV3Service {
|
|||||||
private final PostingTaskService postingTaskService;
|
private final PostingTaskService postingTaskService;
|
||||||
private final MinIOService minIOService;
|
private final MinIOService minIOService;
|
||||||
|
|
||||||
|
// Решение проблемы с @Async (Self-Injection)
|
||||||
|
@Autowired
|
||||||
|
@Lazy
|
||||||
|
private MarketingStrategyV3Service self;
|
||||||
|
|
||||||
private final ObjectMapper objectMapper = new ObjectMapper()
|
private final ObjectMapper objectMapper = new ObjectMapper()
|
||||||
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||||
|
|
||||||
@@ -76,7 +83,9 @@ public class MarketingStrategyV3Service {
|
|||||||
addStatusHistoryEntry(strategy, "queued", "Запуск генерации. ИИ проектирует массированный контент-план...");
|
addStatusHistoryEntry(strategy, "queued", "Запуск генерации. ИИ проектирует массированный контент-план...");
|
||||||
|
|
||||||
strategy = repository.save(strategy);
|
strategy = repository.save(strategy);
|
||||||
processStrategyGenerationAsync(strategy.getId(), analysisDoc, strategy);
|
|
||||||
|
// Вызов через прокси для корректной работы @Async
|
||||||
|
self.processStrategyGenerationAsync(strategy.getId(), analysisDoc, strategy);
|
||||||
|
|
||||||
return strategy;
|
return strategy;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user