Merge branch 'develop' of 10.10.31.70:/ervu-business-metrics into develop

This commit is contained in:
Тимур 2025-08-15 14:27:44 +03:00
commit af11480c62
133 changed files with 364 additions and 312 deletions

View file

@ -5,7 +5,7 @@
<parent>
<groupId>ru.micord.ervu</groupId>
<artifactId>business-metrics</artifactId>
<version>1.9.11</version>
<version>1.11.0</version>
</parent>
<groupId>ru.micord.ervu.business-metrics</groupId>
<artifactId>backend</artifactId>

View file

@ -42,16 +42,16 @@ public class SessionResponseHolder {
SessionAccumulator acc = sessionsMap.get(requestKey);
long startTime = System.nanoTime();
LOGGER.info("Начало ожидания сессий для requestKey = {}", requestKey);
LOGGER.info("Starting to await sessions for requestKey = {}", requestKey);
while (acc == null && (System.nanoTime() - startTime) < unit.toNanos(timeout)) {
LOGGER.debug("Аккумулятор для requestKey = {} еще не найден, повторная проверка", requestKey);
LOGGER.debug("Accumulator for requestKey = {} not found yet, retrying", requestKey);
TimeUnit.MILLISECONDS.sleep(50);
acc = sessionsMap.get(requestKey);
}
if (acc == null) {
LOGGER.error("Аккумулятор для requestKey: {} не был инициализирован за время ожидания.", requestKey);
LOGGER.error("Accumulator for requestKey: {} was not initialized within the timeout period.", requestKey);
return List.of();
}

View file

@ -43,23 +43,23 @@ public class SessionService {
List<UserSessionInfo> sessions = fetchSessions();
if (!sessions.isEmpty()) {
activeSessionDao.saveAll(sessions);
LOGGER.info("Синхронизировано {} сессий", sessions.size());
LOGGER.info("Synchronized {} sessions", sessions.size());
}
else {
LOGGER.info("Нет сессий для синхронизации");
LOGGER.info("No sessions to synchronize");
}
}
private List<UserSessionInfo> fetchSessions() {
String requestKey = UUID.randomUUID().toString();
LOGGER.info("Отправка запроса с requestKey = {}", requestKey);
LOGGER.info("Sending request with requestKey = {}", requestKey);
kafkaTemplate.send(sessionTopic, requestKey, "{}");
try {
return holder.awaitSessions(requestKey, timeout, TimeUnit.SECONDS);
}
catch (Exception e) {
LOGGER.error("Ошибка при получении сессий по ключу {}", requestKey, e);
LOGGER.error("Error while fetching sessions for key {}", requestKey, e);
return List.of();
}
finally {