mirror of
https://github.com/minio/minio.git
synced 2025-01-11 15:03:22 -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 {
|
||||
targetMap = make(map[event.TargetID]event.RulesMap)
|
||||
}
|
||||
targetMap[target.ID()] = rulesMap.Clone()
|
||||
|
||||
rulesMap = rulesMap.Clone()
|
||||
targetMap[target.ID()] = rulesMap
|
||||
sys.bucketRemoteTargetRulesMap[bucketName] = targetMap
|
||||
|
||||
rulesMap = rulesMap.Clone()
|
||||
rulesMap.Add(sys.bucketRulesMap[bucketName])
|
||||
sys.bucketRulesMap[bucketName] = rulesMap
|
||||
|
||||
sys.Unlock()
|
||||
|
||||
sys.AddRulesMap(bucketName, rulesMap)
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -341,8 +347,12 @@ func (sys *NotificationSys) AddRulesMap(bucketName string, rulesMap event.RulesM
|
||||
rulesMap.Add(targetRulesMap)
|
||||
}
|
||||
|
||||
rulesMap.Add(sys.bucketRulesMap[bucketName])
|
||||
sys.bucketRulesMap[bucketName] = rulesMap
|
||||
// Do not add for an empty rulesMap.
|
||||
if len(rulesMap) == 0 {
|
||||
delete(sys.bucketRulesMap, bucketName)
|
||||
} else {
|
||||
sys.bucketRulesMap[bucketName] = rulesMap
|
||||
}
|
||||
}
|
||||
|
||||
// RemoveRulesMap - removes rules map for bucket name.
|
||||
|
Loading…
Reference in New Issue
Block a user