日志相关功能修改
This commit is contained in:
parent
4c3d22db3c
commit
13943cd7e2
@ -10,6 +10,7 @@ import jakarta.servlet.http.HttpServletRequest;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyEmitter;
|
||||||
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
|
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -121,6 +122,11 @@ public class MemoryLogManager implements LoggerManager {
|
|||||||
pipTaskLog.setContent(pipTaskLog.getContent()+logCache.toString());
|
pipTaskLog.setContent(pipTaskLog.getContent()+logCache.toString());
|
||||||
updateList.add(pipTaskLog);
|
updateList.add(pipTaskLog);
|
||||||
taskIdDbMap.remove(taskId);
|
taskIdDbMap.remove(taskId);
|
||||||
|
taskIdMemoryLogMap.remove(taskId);
|
||||||
|
List<SseEmitter> sseEmitters = taskIdSSEMap.get(taskId);
|
||||||
|
if (!CollectionUtils.isEmpty(sseEmitters)) {
|
||||||
|
sseEmitters.forEach(ResponseBodyEmitter::complete);
|
||||||
|
}
|
||||||
// logDao.updateById(pipTaskLog);
|
// logDao.updateById(pipTaskLog);
|
||||||
} else {
|
} else {
|
||||||
// 不存在就新增
|
// 不存在就新增
|
||||||
@ -130,6 +136,12 @@ public class MemoryLogManager implements LoggerManager {
|
|||||||
// logDao.insert(pipTaskLog);
|
// logDao.insert(pipTaskLog);
|
||||||
// taskIdDbMap.put(taskId,pipTaskLog.getId());
|
// taskIdDbMap.put(taskId,pipTaskLog.getId());
|
||||||
insertList.add(pipTaskLog);
|
insertList.add(pipTaskLog);
|
||||||
|
taskIdDbMap.remove(taskId);
|
||||||
|
taskIdMemoryLogMap.remove(taskId);
|
||||||
|
List<SseEmitter> sseEmitters = taskIdSSEMap.get(taskId);
|
||||||
|
if (!CollectionUtils.isEmpty(sseEmitters)) {
|
||||||
|
sseEmitters.forEach(ResponseBodyEmitter::complete);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user