Skip to content
This repository has been archived by the owner on Dec 13, 2023. It is now read-only.

Set scheduledTime and startTime with currentTime for all system tasks #3278

Merged
merged 2 commits into from
Oct 10, 2022

Conversation

skorse
Copy link
Contributor

@skorse skorse commented Oct 7, 2022

Pull Request type

  • Bugfix
  • Feature
  • Refactoring (no functional changes, no api changes)
  • Build related changes (Please run ./gradlew generateLock saveLock to refresh dependencies)
  • WHOSUSING.md
  • Other (please describe):

NOTE: Please remember to run ./gradlew spotlessApply to fix any format violations.

Changes in this PR
Set scheduledTime and startTime with currentTime for all system tasks

Describe the new behavior from this PR, and why it's needed
Issue #

Alternatives considered

Describe alternative implementation you have considered

@@ -51,7 +51,9 @@ public List<TaskModel> getMappedTasks(TaskMapperContext taskMapperContext) {
TaskModel joinTask = taskMapperContext.createTaskModel();
joinTask.setTaskType(TaskType.TASK_TYPE_EXCLUSIVE_JOIN);
joinTask.setTaskDefName(TaskType.TASK_TYPE_EXCLUSIVE_JOIN);
joinTask.setStartTime(System.currentTimeMillis());
final long currentTimeMillis = System.currentTimeMillis();
joinTask.setScheduledTime(currentTimeMillis);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

taskMapperContext.createTaskModel() sets the scheduledTime already. I missed that during our discussion. I don't see a need to scheduledTime in the TaskMapper implementations.

Its possible that queueWaitTime is a non-zero value for synchronous system tasks, but as long as its not below zero, we are good.

@@ -192,7 +192,9 @@ public List<TaskModel> createTasks(List<TaskModel> tasks) {
// update the task_lookup table
tasks.forEach(
task -> {
task.setScheduledTime(System.currentTimeMillis());
if (task.getScheduledTime() == 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This solves the negative queue wait time.

@jxu-nflx
Copy link
Contributor

nit: Title and description of this PR to be modified to maybe "fix scheduleTime of task"?

@jxu-nflx jxu-nflx self-requested a review October 10, 2022 18:11
@skorse skorse merged commit ffa4210 into main Oct 10, 2022
@skorse skorse deleted the tasks/MWI-4643 branch October 10, 2022 20:22
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants