поменял инфу в логгер

This commit is contained in:
adel.ka 2025-07-01 11:07:41 +03:00
parent 341dc30402
commit 4f84fbe09c
2 changed files with 7 additions and 7 deletions

View file

@ -42,16 +42,16 @@ public class SessionResponseHolder {
SessionAccumulator acc = sessionsMap.get(requestKey); SessionAccumulator acc = sessionsMap.get(requestKey);
long startTime = System.nanoTime(); 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)) { 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); TimeUnit.MILLISECONDS.sleep(50);
acc = sessionsMap.get(requestKey); acc = sessionsMap.get(requestKey);
} }
if (acc == null) { if (acc == null) {
LOGGER.error("Аккумулятор для requestKey: {} не был инициализирован за время ожидания.", requestKey); LOGGER.error("Accumulator for requestKey: {} was not initialized within the timeout period.", requestKey);
return List.of(); return List.of();
} }

View file

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