Skip to content

Commit

Permalink
perf: 执行引擎部分代码优化 TencentBlueKing#1616
Browse files Browse the repository at this point in the history
添加注释
  • Loading branch information
jsonwan committed Dec 19, 2022
1 parent b498b39 commit 8929792
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import org.springframework.stereotype.Component;

/**
* 任务驱逐策略执行器
* 任务驱逐策略执行器,用于判定某个任务在当前驱逐策略下是否应当被驱逐,提供任务被驱逐后更新任务相关状态的方法
*/
@Slf4j
@Component
Expand Down Expand Up @@ -65,13 +65,15 @@ public boolean shouldEvictTask(TaskInstanceDTO taskInstance) {
}

/**
* 更新被驱逐的任务的状态为被丢弃状态
* 更新被驱逐的任务相关状态为被丢弃状态
*
* @param taskInstance 任务实例
* @param stepInstance 步骤实例
*/
public void updateEvictedTaskStatus(TaskInstanceDTO taskInstance, StepInstanceBaseDTO stepInstance) {
long endTime = System.currentTimeMillis();
Long taskInstanceId = stepInstance.getTaskInstanceId();
// 将进行中的被驱逐任务的步骤实例状态更新为“被丢弃”状态
if (!RunStatusEnum.isFinishedStatus(stepInstance.getStatus())) {
long totalTime = TaskCostCalculator.calculate(
stepInstance.getStartTime(),
Expand All @@ -92,6 +94,7 @@ public void updateEvictedTaskStatus(TaskInstanceDTO taskInstance, StepInstanceBa
stepInstance.getStatus()
);
}
// 将进行中的被驱逐任务外层状态更新为“被丢弃”状态
if (!RunStatusEnum.isFinishedStatus(taskInstance.getStatus())) {
long totalTime = TaskCostCalculator.calculate(
taskInstance.getStartTime(),
Expand Down

0 comments on commit 8929792

Please sign in to comment.