Skip to content

Commit

Permalink
[INLONG-10094][agent] Modify based on comments
Browse files Browse the repository at this point in the history
  • Loading branch information
justinwwhuang committed Apr 28, 2024
1 parent b9d425e commit 54bc3a4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ private Runnable coreThread() {
}

private void printInstanceState() {
if (AgentUtils.getCurrentTime() - lastPrintTime > INSTANCE_PRINT_INTERVAL_MS) {
long currentTime = AgentUtils.getCurrentTime();
if (currentTime - lastPrintTime > INSTANCE_PRINT_INTERVAL_MS) {
List<InstanceProfile> instances = instanceDb.getInstances(taskId);
InstancePrintStat stat = new InstancePrintStat();
for (int i = 0; i < instances.size(); i++) {
Expand All @@ -188,7 +189,7 @@ private void printInstanceState() {
LOGGER.info(
"instanceManager running! taskId {} mem {} db total {} {} action count {}",
taskId, instanceMap.size(), instances.size(), stat, actionQueue.size());
lastPrintTime = AgentUtils.getCurrentTime();
lastPrintTime = currentTime;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,20 +143,20 @@ private void cleanDbInstance() {
String taskId = instanceFromDb.getTaskId();
String instanceId = instanceFromDb.getInstanceId();
if (instanceFromDb.getState() != InstanceStateEnum.FINISHED) {
return;
continue;
}
TaskProfile taskFromDb = taskProfileDb.getTask(taskId);
if (taskFromDb != null) {
if (taskFromDb.getCycleUnit().compareToIgnoreCase(CycleUnitType.REAL_TIME) == 0) {
return;
continue;
}
if (taskFromDb.isRetry()) {
if (taskFromDb.getState() != TaskStateEnum.RETRY_FINISH) {
return;
continue;
}
} else {
if (instanceFromDb.getState() != InstanceStateEnum.FINISHED) {
return;
continue;
}
}
}
Expand Down

0 comments on commit 54bc3a4

Please sign in to comment.