If a org is missing then don't add it to list

Requests to /me and deleting organization can result in a race condition
pull/10616/head
Brandon Farmer 2018-04-04 15:24:50 -07:00
parent 4a8500d9f1
commit a39696c549
1 changed files with 7 additions and 0 deletions

View File

@ -380,6 +380,13 @@ func (s *Service) usersOrganizations(ctx context.Context, u *chronograf.User) ([
orgs := []chronograf.Organization{}
for orgID, _ := range orgIDs {
org, err := s.Store.Organizations(ctx).Get(ctx, chronograf.OrganizationQuery{ID: &orgID})
// There can be race conditions between deleting a organization and the me query
if err == chronograf.ErrOrganizationNotFound {
continue
}
// Any other error should cause an error to be returned
if err != nil {
return nil, err
}