Skip to content

Commit

Permalink
feat: handle consolidated configuration change event
Browse files Browse the repository at this point in the history
Signed-off-by: Skye Gill <[email protected]>
  • Loading branch information
skyerus committed Jan 4, 2023
1 parent 97de4dd commit 3d6d4fb
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions providers/flagd/pkg/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -480,17 +480,19 @@ func (p *Provider) handleConfigurationChangeEvent(ctx context.Context, event *sc
return errors.New("no data in event")
}

flagKeyVal, ok := event.Data.AsMap()["flagKey"]
flagsVal, ok := event.Data.AsMap()["flags"]
if !ok {
return errors.New("no flagKey field in event data")
return errors.New("no flags field in event data")
}

flagKey, ok := flagKeyVal.(string)
flags, ok := flagsVal.(map[string]interface{})
if !ok {
return errors.New("flagKey is not a string")
return errors.New("flags isn't a map")
}

p.cache.Remove(flagKey)
for flagKey, _ := range flags {
p.cache.Remove(flagKey)
}

return nil
}

0 comments on commit 3d6d4fb

Please sign in to comment.