Skip to content

Commit

Permalink
fix(meta): Disable device notification by default
Browse files Browse the repository at this point in the history
Set Notifications.PostDeviceChanges to false by default in core-metadata, because support-notifications service is not always up.
Modify the logging level Warn when sending notifications failed.
Close #3768

Signed-off-by: Cloud Tsai <[email protected]>
  • Loading branch information
cloudxxx8 committed Oct 31, 2021
1 parent adab524 commit 0eb2b22
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cmd/core-metadata/res/configuration.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Type = "consul"
Type = "redisdb"

[Notifications]
PostDeviceChanges = true
PostDeviceChanges = false
Content = "Meatadata notice: "
Sender = "core-metadata"
Description = "Metadata change notice"
Expand Down
2 changes: 1 addition & 1 deletion internal/core/metadata/application/notify.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ func sendNotification(ctx context.Context, dic *di.Container, name string, actio
req := requests.NewAddNotificationRequest(dto)
res, err := client.SendNotification(ctx, []requests.AddNotificationRequest{req})
if err != nil {
lc.Errorf("fail to send the notification for %s, err: %v", name, err)
lc.Warnf("fail to send the notification for %s, err: %v", name, err)
return
}
if len(res) > 0 && res[0].StatusCode > http.StatusMultiStatus {
Expand Down

0 comments on commit 0eb2b22

Please sign in to comment.