Skip to content

Commit

Permalink
recalculate data operation duration (#3375)
Browse files Browse the repository at this point in the history
Signed-off-by: wangshulin <[email protected]>
  • Loading branch information
wangshli authored Aug 6, 2023
1 parent c1d91d5 commit b61a861
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pkg/controllers/v1alpha1/databackup/status_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (o *OnceHandler) GetOperationStatus(ctx runtime.ReconcileRequestContext, ob
// fail to get finishTime, use current time as default
finishTime = time.Now()
}
result.Duration = utils.CalculateDuration(object.GetCreationTimestamp().Time, finishTime)
result.Duration = utils.CalculateDuration(backupPod.CreationTimestamp.Time, finishTime)

if kubeclient.IsSucceededPod(backupPod) {
result.Phase = common.PhaseComplete
Expand Down
4 changes: 2 additions & 2 deletions pkg/controllers/v1alpha1/dataload/status_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (r *OnceStatusHandler) GetOperationStatus(ctx cruntime.ReconcileRequestCont
} else {
result.Phase = common.PhaseComplete
}
result.Duration = utils.CalculateDuration(object.GetCreationTimestamp().Time, jobCondition.LastTransitionTime.Time)
result.Duration = utils.CalculateDuration(job.CreationTimestamp.Time, jobCondition.LastTransitionTime.Time)

return
}
Expand Down Expand Up @@ -165,7 +165,7 @@ func (c *CronStatusHandler) GetOperationStatus(ctx cruntime.ReconcileRequestCont
} else {
result.Phase = common.PhaseComplete
}
result.Duration = utils.CalculateDuration(object.GetCreationTimestamp().Time, jobCondition.LastTransitionTime.Time)
result.Duration = utils.CalculateDuration(currentJob.CreationTimestamp.Time, jobCondition.LastTransitionTime.Time)
return
}
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/controllers/v1alpha1/datamigrate/status_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func (m *OnceStatusHandler) GetOperationStatus(ctx cruntime.ReconcileRequestCont
} else {
result.Phase = common.PhaseComplete
}
result.Duration = utils.CalculateDuration(object.GetCreationTimestamp().Time, jobCondition.LastTransitionTime.Time)
result.Duration = utils.CalculateDuration(job.CreationTimestamp.Time, jobCondition.LastTransitionTime.Time)
return
}
}
Expand Down Expand Up @@ -168,7 +168,7 @@ func (c *CronStatusHandler) GetOperationStatus(ctx cruntime.ReconcileRequestCont
} else {
result.Phase = common.PhaseComplete
}
result.Duration = utils.CalculateDuration(object.GetCreationTimestamp().Time, jobCondition.LastTransitionTime.Time)
result.Duration = utils.CalculateDuration(currentJob.CreationTimestamp.Time, jobCondition.LastTransitionTime.Time)
return
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/controllers/v1alpha1/dataprocess/status_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func (handler *OnceStatusHandler) GetOperationStatus(ctx runtime.ReconcileReques
} else {
result.Phase = common.PhaseComplete
}
result.Duration = utils.CalculateDuration(object.GetCreationTimestamp().Time, jobCondition.LastTransitionTime.Time)
result.Duration = utils.CalculateDuration(job.CreationTimestamp.Time, jobCondition.LastTransitionTime.Time)

return
}
Expand Down

0 comments on commit b61a861

Please sign in to comment.