mirror of
https://github.com/minio/minio.git
synced 2025-01-25 21:53:16 -05:00
Remove notifications Fix (#6082)
Remove all the notifications for an empty rulesMap Fixes #6053
This commit is contained in:
parent
5c9354894b
commit
65e05a06fb
@ -192,11 +192,17 @@ func (sys *NotificationSys) AddRemoteTarget(bucketName string, target event.Targ
|
|||||||
if targetMap == nil {
|
if targetMap == nil {
|
||||||
targetMap = make(map[event.TargetID]event.RulesMap)
|
targetMap = make(map[event.TargetID]event.RulesMap)
|
||||||
}
|
}
|
||||||
targetMap[target.ID()] = rulesMap.Clone()
|
|
||||||
|
rulesMap = rulesMap.Clone()
|
||||||
|
targetMap[target.ID()] = rulesMap
|
||||||
sys.bucketRemoteTargetRulesMap[bucketName] = targetMap
|
sys.bucketRemoteTargetRulesMap[bucketName] = targetMap
|
||||||
|
|
||||||
|
rulesMap = rulesMap.Clone()
|
||||||
|
rulesMap.Add(sys.bucketRulesMap[bucketName])
|
||||||
|
sys.bucketRulesMap[bucketName] = rulesMap
|
||||||
|
|
||||||
sys.Unlock()
|
sys.Unlock()
|
||||||
|
|
||||||
sys.AddRulesMap(bucketName, rulesMap)
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -341,8 +347,12 @@ func (sys *NotificationSys) AddRulesMap(bucketName string, rulesMap event.RulesM
|
|||||||
rulesMap.Add(targetRulesMap)
|
rulesMap.Add(targetRulesMap)
|
||||||
}
|
}
|
||||||
|
|
||||||
rulesMap.Add(sys.bucketRulesMap[bucketName])
|
// Do not add for an empty rulesMap.
|
||||||
sys.bucketRulesMap[bucketName] = rulesMap
|
if len(rulesMap) == 0 {
|
||||||
|
delete(sys.bucketRulesMap, bucketName)
|
||||||
|
} else {
|
||||||
|
sys.bucketRulesMap[bucketName] = rulesMap
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// RemoveRulesMap - removes rules map for bucket name.
|
// RemoveRulesMap - removes rules map for bucket name.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user