Skip to content

Commit

Permalink
fix: new repos were treated as failed
Browse files Browse the repository at this point in the history
  • Loading branch information
PhotonQuantum committed Jul 3, 2024
1 parent f6671c3 commit 2622559
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions pkg/manager/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ type Status struct {
type WorkerCheckPoint struct {
LastInvokeTime time.Time `json:"last_invoke_time"`
LastFinished *time.Time `json:"last_finished,omitempty"`
Result bool `json:"result,omitempty"`
Result *bool `json:"result,omitempty"`
}

type CheckPoint struct {
Expand Down Expand Up @@ -92,10 +92,15 @@ func workerFromCheckpoint(repoConfig config.RepoConfig, checkpoint *CheckPoint,
return worker.NewWorker(repoConfig, lastInvokeTime, true)
}

if info.LastFinished == nil {
return worker.NewWorker(repoConfig, lastInvokeTime, info.Result)
result := true
if info.Result != nil {
result = *info.Result
}
return worker.NewWorker(repoConfig, *info.LastFinished, info.Result)
lastFinished := lastInvokeTime
if info.LastFinished != nil {
lastFinished = *info.LastFinished
}
return worker.NewWorker(repoConfig, lastFinished, result)
}

// NewManager creates a new manager with attached workers from config
Expand Down Expand Up @@ -148,7 +153,7 @@ func (m *Manager) checkpoint() error {

ckptObj.WorkerInfo[name] = WorkerCheckPoint{
LastInvokeTime: lastInvokeTime,
Result: status.Result,
Result: &status.Result,
LastFinished: &status.LastFinished,
}
}
Expand Down

0 comments on commit 2622559

Please sign in to comment.