Skip to content

Commit

Permalink
Code changes in decider service
Browse files Browse the repository at this point in the history
  • Loading branch information
Shailesh Jagannath Padave committed Nov 19, 2024
1 parent da987b6 commit 5b018ae
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ public long getTotalTimeoutSeconds() {
public void setTotalTimeoutSeconds(long totalTimeoutSeconds) {
this.totalTimeoutSeconds = totalTimeoutSeconds;
}

public String toString() {
return name;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,7 @@ Optional<TaskModel> retry(
rescheduled.setStartTime(0);
rescheduled.setEndTime(0);
rescheduled.setWorkerId(null);
rescheduled.setFirstStartTime(task.getFirstStartTime());

if (StringUtils.isNotBlank(task.getExternalInputPayloadStoragePath())) {
rescheduled.setExternalInputPayloadStoragePath(
Expand Down Expand Up @@ -710,14 +711,22 @@ void checkTaskTimeout(TaskDef taskDef, TaskModel task) {
}

long timeout = 1000L * taskDef.getTimeoutSeconds();
long totalTaskTimeout = 1000L * taskDef.getTotalTimeoutSeconds();
long now = System.currentTimeMillis();
long elapsedTime =
now - (task.getStartTime() + ((long) task.getStartDelayInSeconds() * 1000L));

long elapsedTimeFromFirstTaskExecution =
now - (task.getFirstStartTime() + ((long) task.getStartDelayInSeconds() * 1000L));

if (elapsedTime < timeout) {
return;
}

if(elapsedTimeFromFirstTaskExecution < totalTaskTimeout) {
return;
}

String reason =
String.format(
"Task timed out after %d seconds. Timeout configured as %d seconds. "
Expand Down

0 comments on commit 5b018ae

Please sign in to comment.