mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
fail fast if two notification queues or inputs are enabled
This commit is contained in:
parent
63619f8b8e
commit
ffa2827ab1
|
@ -41,6 +41,17 @@ func runFilerReplicate(cmd *Command, args []string) bool {
|
||||||
|
|
||||||
var notificationInput sub.NotificationInput
|
var notificationInput sub.NotificationInput
|
||||||
|
|
||||||
|
enabledInput := ""
|
||||||
|
for _, input := range sub.NotificationInputs {
|
||||||
|
if config.GetBool("notification." + input.GetName() + ".enabled") {
|
||||||
|
if enabledInput == "" {
|
||||||
|
enabledInput = input.GetName()
|
||||||
|
} else {
|
||||||
|
glog.Fatalf("Notification input is enabled for both %s and %s", enabledInput, input.GetName())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for _, input := range sub.NotificationInputs {
|
for _, input := range sub.NotificationInputs {
|
||||||
if config.GetBool("notification." + input.GetName() + ".enabled") {
|
if config.GetBool("notification." + input.GetName() + ".enabled") {
|
||||||
viperSub := config.Sub("notification." + input.GetName())
|
viperSub := config.Sub("notification." + input.GetName())
|
||||||
|
|
|
@ -27,15 +27,26 @@ func LoadConfiguration(config *viper.Viper) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, store := range MessageQueues {
|
enabledQueue := ""
|
||||||
if config.GetBool(store.GetName() + ".enabled") {
|
for _, queue := range MessageQueues {
|
||||||
viperSub := config.Sub(store.GetName())
|
if config.GetBool(queue.GetName() + ".enabled") {
|
||||||
if err := store.Initialize(viperSub); err != nil {
|
if enabledQueue == "" {
|
||||||
glog.Fatalf("Failed to initialize notification for %s: %+v",
|
enabledQueue = queue.GetName()
|
||||||
store.GetName(), err)
|
} else {
|
||||||
|
glog.Fatalf("Notification message queue is enabled for both %s and %s", enabledQueue, queue.GetName())
|
||||||
}
|
}
|
||||||
Queue = store
|
}
|
||||||
glog.V(0).Infof("Configure notification message queue for %s", store.GetName())
|
}
|
||||||
|
|
||||||
|
for _, queue := range MessageQueues {
|
||||||
|
if config.GetBool(queue.GetName() + ".enabled") {
|
||||||
|
viperSub := config.Sub(queue.GetName())
|
||||||
|
if err := queue.Initialize(viperSub); err != nil {
|
||||||
|
glog.Fatalf("Failed to initialize notification for %s: %+v",
|
||||||
|
queue.GetName(), err)
|
||||||
|
}
|
||||||
|
Queue = queue
|
||||||
|
glog.V(0).Infof("Configure notification message queue for %s", queue.GetName())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue