Skip to content

Commit

Permalink
refactor(store.go): remove unused variable 'indexes' and handle curso…
Browse files Browse the repository at this point in the history
…r error in ensureIndexes function
  • Loading branch information
bounoable committed May 15, 2023
1 parent 72fc834 commit 0016ea1
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions backend/mongo/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -620,10 +620,6 @@ func (s *EventStore) ensureIndexes(ctx context.Context) error {
if err != nil {
return fmt.Errorf("list existing indexes: %w", err)
}
var indexes []bson.M
if err := cur.All(ctx, &indexes); err != nil {
return fmt.Errorf("index cursor: %w", err)
}
defer cur.Close(ctx)

indexNames := make(map[string]bool)
Expand All @@ -634,6 +630,9 @@ func (s *EventStore) ensureIndexes(ctx context.Context) error {
}
indexNames[idx.Name] = true
}
if err := cur.Err(); err != nil {
return fmt.Errorf("cursor error: %w", err)
}

for _, model := range models {
if model.Options == nil {
Expand Down

0 comments on commit 0016ea1

Please sign in to comment.