Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
  • Loading branch information
wyxxxcat committed Nov 28, 2024
1 parent 38088d2 commit 361c578
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions pkg/service/http_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ func (s *HttpService) jobProgressHandler(w http.ResponseWriter, r *http.Request)

type result struct {
*defaultResult
JobProgress string `json:"job_progress"`
JobProgress ccr.JobProgress `json:"job_progress"`
}

var jobResult *result
Expand Down Expand Up @@ -549,12 +549,22 @@ func (s *HttpService) jobProgressHandler(w http.ResponseWriter, r *http.Request)
return
}

if jobProgress, err := s.db.GetProgress(request.Name); err != nil {
if jobProgressData, err := s.db.GetProgress(request.Name); err != nil {
log.Warnf("get job progress failed: %+v", err)
jobResult = &result{
defaultResult: newErrorResult(err.Error()),
}
} else {
var jobProgress ccr.JobProgress
err := json.Unmarshal([]byte(jobProgressData), &jobProgress)
if err != nil {
log.Warnf("unmarshal get job progress error")
jobResult = &result{
defaultResult: newErrorResult(err.Error()),
}
return
}
jobProgress.PersistData = ""
jobResult = &result{
defaultResult: newSuccessResult(),
JobProgress: jobProgress,
Expand Down

0 comments on commit 361c578

Please sign in to comment.