summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan <zhaoran11@huawei.com>2023-03-27 10:07:10 +0800
committerShelley-BaoYue <baoyue2@huawei.com>2023-09-01 16:58:21 +0800
commitb23c25b08e9461863384460fe74d53a4265be3ea (patch)
tree5c56667d244ee91493e35458cf4e7244e8f2466e
parentMerge pull request #4973 from fisherxu/automated-cherry-pick-of-#4960-upstrea... (diff)
downloadkubeedge-b23c25b08e9461863384460fe74d53a4265be3ea.tar.gz
edgehub process send twin msg to twingroup directly to avoid the response of device report be handled by beehiveContext.SendResp()
Signed-off-by: Ryan <zhaoran11@huawei.com>
-rw-r--r--edge/pkg/devicetwin/process.go2
-rw-r--r--edge/pkg/edgehub/process.go8
2 files changed, 10 insertions, 0 deletions
diff --git a/edge/pkg/devicetwin/process.go b/edge/pkg/devicetwin/process.go
index f6ab34e99..5c2197192 100644
--- a/edge/pkg/devicetwin/process.go
+++ b/edge/pkg/devicetwin/process.go
@@ -52,8 +52,10 @@ func (dt *DeviceTwin) distributeMsg(m interface{}) error {
klog.Infof("Send msg to the %s module in twin", dtcommon.CommModule)
confirmMsg := dttype.DTMessage{Msg: model.NewMessage(message.Msg.GetParentID()), Action: dtcommon.Confirm}
if err := dt.DTContexts.CommTo(dtcommon.CommModule, &confirmMsg); err != nil {
+ klog.Errorf("fail to send msg %s to CommModule with err: %+v", confirmMsg.Msg.Header.ID, err)
return err
}
+ return nil
}
if !classifyMsg(&message) {
return errors.New("not found action")
diff --git a/edge/pkg/edgehub/process.go b/edge/pkg/edgehub/process.go
index 05499e3f6..bc08f02bb 100644
--- a/edge/pkg/edgehub/process.go
+++ b/edge/pkg/edgehub/process.go
@@ -73,6 +73,14 @@ func (*defaultHandler) Process(message *model.Message, clientHub clients.Adapter
md = modules.BusGroup
}
+ // TODO: just for a temporary fix.
+ // The code related to device twin message transmission will be reconstructed
+ // by using sendSync function instead of send function.
+ if group == messagepkg.TwinGroupName {
+ beehiveContext.SendToGroup(md, *message)
+ return nil
+ }
+
isResponse := isSyncResponse(message.GetParentID())
if isResponse {
beehiveContext.SendResp(*message)