REM:
1. Fix DDOSAQ-891
2. Fix DDOSAQ-892
3. Fix DDOSAQ-898
4. Fix DDOSAQ-901
5. Fix DDOSAQ-912
This commit is contained in:
HuangXin 2020-06-02 14:49:41 +08:00
parent 126e1d47f4
commit 6bcebb0fd0
5 changed files with 9 additions and 13 deletions

View File

@ -100,7 +100,7 @@ public class DisposeTaskController {
StartTaskReq reqInfo = mr.getRequestObject(StartTaskReq.class);
if (reqInfo.getId() == null) {
if (reqInfo.getId() == null || reqInfo.getId().length() == 0) {
log.error("Request id params error, error:{} --> {}", mr.getMsgContent(), reqInfo.getId());
return ProtocolRespDTO.result(ErrorCode.ERR_PARAMS);
}

View File

@ -17,7 +17,7 @@ import lombok.NoArgsConstructor;
@AllArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
public class StartTaskReq {
private Integer id;
private String id;
private Integer type;
private String disposeIp;
private Integer disposeTime;

View File

@ -348,11 +348,7 @@ public class TaskServiceImpl implements TaskService {
*/
@Override
public List<TaskInfoDetail> getNodeAllTask(Long devId) {
List<TaskInfoDetail> taskList = taskCacheManager
.getAllTask()
.stream()
.filter(v -> v.getDeviceId().equals(devId))
.collect(Collectors.toList());
List<TaskInfoDetail> taskList = disposeTaskMapper.getAllTaskByNodeDevId(devId);
if (taskList.size() > 0) {
log.info("The device has tasks: devId:{}, tasksNumber:{}", devId, taskList.size());

View File

@ -40,11 +40,6 @@ public class TaskManagerTask {
while (it.hasNext()) {
TaskInfoDetail taskData = it.next();
// 如果重试次数过多停止处理该任务
if(taskData.getRetryTimes() < GlobalVar.TASK_ERROR_MAX_RETRY) {
continue;
}
// 判断是否存在正在运行的过期的任务如果存在则结束该任务
if(taskService.taskIsExpired(taskData) && taskService.taskIsRunning(taskData)) {
log.info("Finish expired task {}:{} begin at {}",
@ -54,6 +49,11 @@ public class TaskManagerTask {
continue;
}
// 如果重试次数过多停止处理该任务
if(taskData.getRetryTimes() > GlobalVar.TASK_ERROR_MAX_RETRY) {
continue;
}
// 判断是否有新建任务如果有的话启动新建的处置任务
if (taskData.getCurrentStatus() == DisposeTaskStatus.TASK_NEW.getCode()) {
log.info("Start task {}:{} of {}",

View File

@ -124,7 +124,7 @@ public class TaskControllerTest extends InitTestEnvironment {
@Test
public void t1_startTask() throws Exception {
StartTaskReq reqData = StartTaskReq.builder()
.id(-1)
.id("-1")
.type(DeviceCapacity.CLEANUP.getCode())
.disposeIp("192.168.3.4")
.disposeTime(60)