summaryrefslogtreecommitdiff
path: root/edge
diff options
context:
space:
mode:
authorjiawei <jiawei.liu@daocloud.io>2023-11-07 14:34:40 +0800
committerjiawei <jiawei.liu@daocloud.io>2023-11-07 14:45:50 +0800
commitd28b351a63163b6adba49580862664fe34663f0f (patch)
treee1db713aca12b61773f35cb496e429b9b01f14cf /edge
parentMerge pull request #5097 from luomengY/generate_crd_charts (diff)
downloadkubeedge-d28b351a63163b6adba49580862664fe34663f0f.tar.gz
servicebus constant optimization
Signed-off-by: jiawei <jiawei.liu@daocloud.io>
Diffstat (limited to 'edge')
-rw-r--r--edge/pkg/common/message/message.go2
-rw-r--r--edge/pkg/servicebus/servicebus.go5
2 files changed, 5 insertions, 2 deletions
diff --git a/edge/pkg/common/message/message.go b/edge/pkg/common/message/message.go
index af06d61e3..4e5120007 100644
--- a/edge/pkg/common/message/message.go
+++ b/edge/pkg/common/message/message.go
@@ -16,6 +16,8 @@ const (
OperationGetResult = "get_result"
OperationResponse = "response"
OperationKeepalive = "keepalive"
+ OperationStart = "start"
+ OperationStop = "stop"
ResourceGroupName = "resource"
TwinGroupName = "twin"
diff --git a/edge/pkg/servicebus/servicebus.go b/edge/pkg/servicebus/servicebus.go
index 873e5931e..d238834c7 100644
--- a/edge/pkg/servicebus/servicebus.go
+++ b/edge/pkg/servicebus/servicebus.go
@@ -18,6 +18,7 @@ import (
beehiveContext "github.com/kubeedge/beehive/pkg/core/context"
beehiveModel "github.com/kubeedge/beehive/pkg/core/model"
commonType "github.com/kubeedge/kubeedge/common/types"
+ "github.com/kubeedge/kubeedge/edge/pkg/common/message"
"github.com/kubeedge/kubeedge/edge/pkg/common/modules"
servicebusConfig "github.com/kubeedge/kubeedge/edge/pkg/servicebus/config"
"github.com/kubeedge/kubeedge/edge/pkg/servicebus/dao"
@@ -123,12 +124,12 @@ func processMessage(msg *beehiveModel.Message) {
}
resource := msg.GetResource()
switch msg.GetOperation() {
- case "start":
+ case message.OperationStart:
dao.InsertUrls(resource)
if atomic.CompareAndSwapInt32(&inited, 0, 1) {
go server(c)
}
- case "stop":
+ case message.OperationStop:
dao.DeleteUrlsByKey(resource)
if dao.IsTableEmpty() {
c <- struct{}{}