mirror of
https://github.com/goharbor/harbor
synced 2025-04-20 20:28:55 +00:00
fix: update stopped execution status immediately instead of async update (#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>
This commit is contained in:
parent
3afa525f0b
commit
d3d6e29aa3
|
@ -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)
|
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
|
// 1. execution status refresh interval <= 0 means update the status immediately
|
||||||
if config.GetExecutionStatusRefreshIntervalSeconds() <= 0 {
|
// 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
|
// update execution status immediately which may have optimistic lock
|
||||||
statusChanged, currentStatus, err := h.executionDAO.RefreshStatus(ctx, task.ExecutionID)
|
statusChanged, currentStatus, err := h.executionDAO.RefreshStatus(ctx, task.ExecutionID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user