Skip to content

Commit

Permalink
fix: update stopped execution status immediately instead of async upd…
Browse files Browse the repository at this point in the history
…ate (#18527)

Update the stopped execution status immediately becasue the user
experience is not good if wait long time when stop or reschedule a job.

Fixes: #18526

Signed-off-by: chlins <chenyuzh@vmware.com>
  • Loading branch information
chlins committed Apr 13, 2023
1 parent 3afa525 commit d3d6e29
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/pkg/task/hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,9 @@ func (h *HookHandler) Handle(ctx context.Context, sc *job.StatusChange) error {
logger.Errorf("failed to run the task status change post function for task %d: %v", task.ID, err)
}
}
// execution status refresh interval <= 0 means update the status immediately
if config.GetExecutionStatusRefreshIntervalSeconds() <= 0 {
// 1. execution status refresh interval <= 0 means update the status immediately
// 2. if the status is Stopped, we should also update the status immediately to avoid long wait time for user
if config.GetExecutionStatusRefreshIntervalSeconds() <= 0 || sc.Status == job.StoppedStatus.String() {
// update execution status immediately which may have optimistic lock
statusChanged, currentStatus, err := h.executionDAO.RefreshStatus(ctx, task.ExecutionID)
if err != nil {
Expand Down

0 comments on commit d3d6e29

Please sign in to comment.