Skip to content

Commit

Permalink
chore: try to fix mysql/postgres tests
Browse files Browse the repository at this point in the history
  • Loading branch information
markphelps committed Nov 6, 2023
1 parent 8d45d51 commit 3227839
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions internal/storage/sql/common/evaluation.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ func (s *Store) GetEvaluationRollouts(ctx context.Context, namespaceKey, flagKey

var (
// rolloutId -> rollout
uniqueEvaluationRollouts = make(map[string]*storage.EvaluationRollout)
uniqueSegmentedEvaluationRollouts = make(map[string]*storage.EvaluationRollout)
// rolloutId -> segmentKey -> segment
uniqueEvaluationRolloutsSegments = make(map[string]map[string]*storage.EvaluationSegment)
evaluationRollouts = []*storage.EvaluationRollout{}
Expand Down Expand Up @@ -387,7 +387,7 @@ func (s *Store) GetEvaluationRollouts(ctx context.Context, namespaceKey, flagKey
}

// check if we've seen this rollout before
if rollout, ok := uniqueEvaluationRollouts[rolloutId]; ok {
if rollout, ok := uniqueSegmentedEvaluationRollouts[rolloutId]; ok {
// check if segment exists and either append constraints to an already existing segment,
// or add another segment to the map.
if segment, ok := uniqueEvaluationRolloutsSegments[rolloutId][rsSegmentKey.String]; ok {
Expand Down Expand Up @@ -445,7 +445,13 @@ func (s *Store) GetEvaluationRollouts(ctx context.Context, namespaceKey, flagKey
},
}

uniqueEvaluationRollouts[rolloutId] = &evaluationRollout
uniqueSegmentedEvaluationRollouts[rolloutId] = &evaluationRollout

if _, ok := uniqueEvaluationRolloutsSegments[rolloutId]; !ok {
uniqueEvaluationRolloutsSegments[rolloutId] = make(map[string]*storage.EvaluationSegment)
}

uniqueEvaluationRolloutsSegments[rolloutId][rsSegmentKey.String] = segment
}

evaluationRollouts = append(evaluationRollouts, &evaluationRollout)
Expand Down

0 comments on commit 3227839

Please sign in to comment.