Handling delete event in redis config store
@@ -327,6 +327,14 @@ func (r *ConfigurationStore) handleSubscribedChange(ctx context.Context, req *co
return
}
+ operation := msg.Payload
+ var items map[string]*configuration.Item
+
+ if operation == "del" {
+ items = map[string]*configuration.Item{
+ targetKey: nil,
+ }
+ } else {
// get all keys if only one is changed
getResponse, err := r.Get(ctx, &configuration.GetRequest{
Metadata: req.Metadata,
@@ -336,10 +344,13 @@ func (r *ConfigurationStore) handleSubscribedChange(ctx context.Context, req *co
r.logger.Errorf("get response from redis failed: %s", err)
return
}
+ items = getResponse.Items
+ }
e := &configuration.UpdateEvent{
- Items: getResponse.Items,
+ Items: items,
ID: id,
+ Operation: operation,
}
err = handler(ctx, e)
if err != nil {
