Fix confusing constant string for unit convertor (#15126)
This commit is contained in:
parent
8c01fcf14b
commit
d675d32771
|
|
@ -306,9 +306,9 @@ public final class Constants {
|
|||
public static final int DEFAULT_WORKER_HOST_WEIGHT = 100;
|
||||
|
||||
/**
|
||||
* time unit second to minutes
|
||||
* unit convertor for minute to second
|
||||
*/
|
||||
public static final int SEC_2_MINUTES_TIME_UNIT = 60;
|
||||
public static final int MINUTE_2_SECOND_TIME_UNIT = 60;
|
||||
|
||||
/***
|
||||
*
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
package org.apache.dolphinscheduler.dao.entity;
|
||||
|
||||
import static org.apache.dolphinscheduler.common.constants.Constants.SEC_2_MINUTES_TIME_UNIT;
|
||||
import static org.apache.dolphinscheduler.common.constants.Constants.MINUTE_2_SECOND_TIME_UNIT;
|
||||
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.TASK_TYPE_BLOCKING;
|
||||
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.TASK_TYPE_CONDITIONS;
|
||||
import static org.apache.dolphinscheduler.plugin.task.api.TaskConstants.TASK_TYPE_DEPENDENT;
|
||||
|
|
@ -410,7 +410,7 @@ public class TaskInstance implements Serializable {
|
|||
Date now = new Date();
|
||||
long failedTimeInterval = DateUtils.differSec(now, getEndTime());
|
||||
// task retry does not over time, return false
|
||||
return getRetryInterval() * SEC_2_MINUTES_TIME_UNIT < failedTimeInterval;
|
||||
return getRetryInterval() * MINUTE_2_SECOND_TIME_UNIT < failedTimeInterval;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
package org.apache.dolphinscheduler.server.master.builder;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static org.apache.dolphinscheduler.common.constants.Constants.SEC_2_MINUTES_TIME_UNIT;
|
||||
import static org.apache.dolphinscheduler.common.constants.Constants.MINUTE_2_SECOND_TIME_UNIT;
|
||||
|
||||
import org.apache.dolphinscheduler.common.enums.TimeoutFlag;
|
||||
import org.apache.dolphinscheduler.common.utils.DateUtils;
|
||||
|
|
@ -86,7 +86,7 @@ public class TaskExecutionContextBuilder {
|
|||
if (taskDefinition.getTimeoutNotifyStrategy() == TaskTimeoutStrategy.FAILED
|
||||
|| taskDefinition.getTimeoutNotifyStrategy() == TaskTimeoutStrategy.WARNFAILED) {
|
||||
taskExecutionContext.setTaskTimeout(
|
||||
Math.min(taskDefinition.getTimeout() * SEC_2_MINUTES_TIME_UNIT, Integer.MAX_VALUE));
|
||||
Math.min(taskDefinition.getTimeout() * MINUTE_2_SECOND_TIME_UNIT, Integer.MAX_VALUE));
|
||||
}
|
||||
}
|
||||
taskExecutionContext.setTaskParams(taskDefinition.getTaskParams());
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ public class StateWheelExecuteThread extends BaseDaemonThread {
|
|||
}
|
||||
long timeRemain = DateUtils.getRemainTime(processInstance.getStartTime(),
|
||||
(long) processInstance.getTimeout()
|
||||
* Constants.SEC_2_MINUTES_TIME_UNIT);
|
||||
* Constants.MINUTE_2_SECOND_TIME_UNIT);
|
||||
if (timeRemain < 0) {
|
||||
log.info("Workflow instance {} timeout, adding timeout event", processInstance.getId());
|
||||
addProcessTimeoutEvent(processInstance);
|
||||
|
|
@ -248,7 +248,7 @@ public class StateWheelExecuteThread extends BaseDaemonThread {
|
|||
if (TimeoutFlag.OPEN == taskInstance.getTaskDefine().getTimeoutFlag()) {
|
||||
long timeRemain = DateUtils.getRemainTime(taskInstance.getStartTime(),
|
||||
(long) taskInstance.getTaskDefine().getTimeout()
|
||||
* Constants.SEC_2_MINUTES_TIME_UNIT);
|
||||
* Constants.MINUTE_2_SECOND_TIME_UNIT);
|
||||
if (timeRemain < 0) {
|
||||
log.info("Task instance is timeout, adding task timeout event and remove the check");
|
||||
addTaskTimeoutEvent(taskInstance);
|
||||
|
|
|
|||
Loading…
Reference in New Issue