From 0eb2b220bb02af9f5e39ccb56da74fa62c43820c Mon Sep 17 00:00:00 2001 From: Cloud Tsai Date: Sun, 31 Oct 2021 21:00:42 +0800 Subject: [PATCH] fix(meta): Disable device notification by default 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 https://github.com/edgexfoundry/edgex-go/issues/3768 Signed-off-by: Cloud Tsai --- cmd/core-metadata/res/configuration.toml | 2 +- internal/core/metadata/application/notify.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/core-metadata/res/configuration.toml b/cmd/core-metadata/res/configuration.toml index ef79dfbb04..ac2541a879 100644 --- a/cmd/core-metadata/res/configuration.toml +++ b/cmd/core-metadata/res/configuration.toml @@ -52,7 +52,7 @@ Type = "consul" Type = "redisdb" [Notifications] -PostDeviceChanges = true +PostDeviceChanges = false Content = "Meatadata notice: " Sender = "core-metadata" Description = "Metadata change notice" diff --git a/internal/core/metadata/application/notify.go b/internal/core/metadata/application/notify.go index c8eb9ab7c5..e9cdd578bd 100644 --- a/internal/core/metadata/application/notify.go +++ b/internal/core/metadata/application/notify.go @@ -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 {