From bcb46ec8aa0bd23902d78f7ad1fe2c39e5b0648c Mon Sep 17 00:00:00 2001 From: zeaslity Date: Tue, 9 Apr 2024 10:10:51 +0800 Subject: [PATCH] [ Cmii ] [ Octopus ] - hot fix manual shut down init queue --- agent-go/a_init/AgentInitialization.go | 4 ++-- agent-go/rabbitmq/RabbitMsgQueue.go | 10 ++++++++++ agent-go/shell/octopus-update.sh | 1 + .../io/wdd/server/func/TestImageSyncScheduler.java | 9 +++++---- 4 files changed, 18 insertions(+), 6 deletions(-) create mode 100644 agent-go/shell/octopus-update.sh diff --git a/agent-go/a_init/AgentInitialization.go b/agent-go/a_init/AgentInitialization.go index 75ae8ad..3318eab 100644 --- a/agent-go/a_init/AgentInitialization.go +++ b/agent-go/a_init/AgentInitialization.go @@ -294,8 +294,8 @@ func handleInitMsgFromServer(initFromServerMsg *rabbitmq.OctopusMessage, initToS // shutdownRegisterQueueConnection 关闭初始化连接的两个队列 func shutdownRegisterQueueConnection(initFromServerQueue *rabbitmq.RabbitQueue, initToServerQueue *rabbitmq.RabbitQueue) { - _ = initFromServerQueue.Close() - _ = initToServerQueue.Close() + initFromServerQueue.ConsumeOK = false + initToServerQueue.ConsumeOK = false log.InfoF("Octopus Agent Init Queue has disconnected!") } diff --git a/agent-go/rabbitmq/RabbitMsgQueue.go b/agent-go/rabbitmq/RabbitMsgQueue.go index 5b51170..955bff1 100644 --- a/agent-go/rabbitmq/RabbitMsgQueue.go +++ b/agent-go/rabbitmq/RabbitMsgQueue.go @@ -46,6 +46,8 @@ type RabbitQueue struct { RabbitConnectInfo *RabbitTCPConnectInfo // 返回消息队列 ReceiveChan *RabbitReceiveChan + // Consume 是否继续 + ConsumeOK bool } // RabbitMQConn is a struct that holds the connection and channel objects @@ -192,6 +194,7 @@ func (r *RabbitQueue) Close() error { func (r *RabbitQueue) Handle() chan bool { deliveries := r.Read(true) + foreverHandle := make(chan bool) // 死循环,处理Octopus Message P.Submit(func() { @@ -208,6 +211,13 @@ func (r *RabbitQueue) Handle() chan bool { P.Submit(func() { om.HandleMsg(r.ReceiveChan) }) + + // 2024年4月9日 + if !r.ConsumeOK { + marshal, _ := json.Marshal(r.RabbitProp) + log.InfoF("Rabbit Queue of %s disconnect!", marshal) + break + } } }) return foreverHandle diff --git a/agent-go/shell/octopus-update.sh b/agent-go/shell/octopus-update.sh new file mode 100644 index 0000000..a9bf588 --- /dev/null +++ b/agent-go/shell/octopus-update.sh @@ -0,0 +1 @@ +#!/bin/bash diff --git a/server/src/test/java/io/wdd/server/func/TestImageSyncScheduler.java b/server/src/test/java/io/wdd/server/func/TestImageSyncScheduler.java index 38942d8..3e45004 100644 --- a/server/src/test/java/io/wdd/server/func/TestImageSyncScheduler.java +++ b/server/src/test/java/io/wdd/server/func/TestImageSyncScheduler.java @@ -42,15 +42,16 @@ public class TestImageSyncScheduler { )); ArrayList ImageFullNameList = new ArrayList<>(List.of( - "harbor.cdcyy.com.cn/cmii/cmii-live-operator:5.2.0", - "harbor.cdcyy.com.cn/cmii/cmii-srs-oss-adaptor:2023-SA" +// "harbor.cdcyy.com.cn/cmii/cmii-live-operator:5.2.0", +// "harbor.cdcyy.com.cn/cmii/cmii-srs-oss-adaptor:2023-SA" + "harbor.cdcyy.com.cn/cmii/cmii-uav-process:5.4.0-040901" )); Boolean downloadAndCompressOnly = false; // String projectNamespace = "wdd"; // wdd -// String projectNamespace = "cqlyj"; // cqlyj - String projectNamespace = "jlyd"; // jlyd + String projectNamespace = "cqlyj"; // cqlyj +// String projectNamespace = "jlyd"; // jlyd // String innerWorkerAgentName = "Chengdu-amd64-65-lapwdd"; //wdd String innerWorkerAgentName = "Chengdu-amd64-71-3571gd"; //prod