Skip to content

Commit

Permalink
fix(datastore): issue getting attempts
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanLonguet committed May 21, 2024
1 parent 4881451 commit 6dcb6cd
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions internal/datastore/storage/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,18 +112,15 @@ func (s *Storage) GetPlan(namespace string, layer string, run string, attempt st
}

func (s *Storage) GetLatestPlan(namespace string, layer string, run string, format string) ([]byte, error) {
attempts, err := s.Backend.List(fmt.Sprintf("/%s/%s/%s/", namespace, layer, run))
attempts, err := s.GetAttempts(namespace, layer, run)
if err != nil {
return nil, err
}
if len(attempts) == 0 {
if attempts == 0 {
return nil, &errors.StorageError{Nil: true}
}
attempt, err := getMax(attempts)
if err != nil {
return nil, err
}
key := computePlanKey(namespace, layer, run, strconv.Itoa(attempt), format)
attempt := strconv.Itoa(attempts - 1)
key := computePlanKey(namespace, layer, run, attempt, format)
return s.Backend.Get(key)
}

Expand Down

0 comments on commit 6dcb6cd

Please sign in to comment.