From 3b276eb4426a0333eaddc329720012338de799be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A7=E7=9F=B3=E5=A4=B4?= Date: Sun, 17 Nov 2024 18:08:41 +0800 Subject: [PATCH] =?UTF-8?q?[fix]=E5=8D=87=E7=BA=A7=E6=A0=B8=E5=BF=83?= =?UTF-8?q?=E5=BA=93=EF=BC=8C=E4=BF=AE=E6=AD=A3StartTime=E4=B8=BA0?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=9BStarAgent=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=97=B6=E5=8F=AF=E8=83=BD=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=EF=BC=8C=E8=AE=B0=E5=BD=95=E8=AF=A6=E6=83=85=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Samples/TestA/TestA.csproj | 2 +- Samples/TestB/TestB.csproj | 2 +- StarAgent/MyStarClient.cs | 8 ++++++++ StarAgent/Program.cs | 9 +++++---- StarAgent/StarAgent.csproj | 2 +- Stardust.Server/Stardust.Server.csproj | 2 +- Stardust.Web/Stardust.Web.csproj | 2 +- Stardust/Stardust.csproj | 4 ++-- Test/Test.csproj | 2 +- 9 files changed, 21 insertions(+), 12 deletions(-) diff --git a/Samples/TestA/TestA.csproj b/Samples/TestA/TestA.csproj index a27d9fdf..454b6e67 100644 --- a/Samples/TestA/TestA.csproj +++ b/Samples/TestA/TestA.csproj @@ -18,7 +18,7 @@ - + diff --git a/Samples/TestB/TestB.csproj b/Samples/TestB/TestB.csproj index ccc10b11..cf022f71 100644 --- a/Samples/TestB/TestB.csproj +++ b/Samples/TestB/TestB.csproj @@ -18,7 +18,7 @@ - + diff --git a/StarAgent/MyStarClient.cs b/StarAgent/MyStarClient.cs index b78cf487..0c4b644f 100644 --- a/StarAgent/MyStarClient.cs +++ b/StarAgent/MyStarClient.cs @@ -90,6 +90,14 @@ protected override void Restart(Upgrade upgrade) var rs = upgrade.Run("StarAgent", "-restart -upgrade"); //!! 这里不需要自杀,外部命令重启服务会结束当前进程 + if (rs) + { + this.WriteInfoEvent("Upgrade", "强制更新完成,新进程已拉起,等待当前服务被重启!"); + } + else + { + this.WriteInfoEvent("Upgrade", "强制更新完成,但拉起新进程失败"); + } } else { diff --git a/StarAgent/Program.cs b/StarAgent/Program.cs index ae08d5af..7367a57d 100644 --- a/StarAgent/Program.cs +++ b/StarAgent/Program.cs @@ -27,15 +27,16 @@ private static void Main(String[] args) #endif XTrace.UseConsole(); + var msWait = 3_000; if ("-upgrade".EqualIgnoreCase(args)) { - XTrace.WriteLine("更新模式启动,等待{0}秒", 5_000); - Thread.Sleep(5_000); + XTrace.WriteLine("更新模式启动,等待{0}秒", msWait); + Thread.Sleep(msWait); } else if ("-delay".EqualIgnoreCase(args)) { - XTrace.WriteLine("延迟启动,等待{0}秒", 5_000); - Thread.Sleep(5_000); + XTrace.WriteLine("延迟启动,等待{0}秒", msWait); + Thread.Sleep(msWait); } var set = StarSetting.Current; diff --git a/StarAgent/StarAgent.csproj b/StarAgent/StarAgent.csproj index 21ef221f..d2127592 100644 --- a/StarAgent/StarAgent.csproj +++ b/StarAgent/StarAgent.csproj @@ -47,7 +47,7 @@ - + diff --git a/Stardust.Server/Stardust.Server.csproj b/Stardust.Server/Stardust.Server.csproj index 1cab7232..300d6732 100644 --- a/Stardust.Server/Stardust.Server.csproj +++ b/Stardust.Server/Stardust.Server.csproj @@ -46,7 +46,7 @@ - + diff --git a/Stardust.Web/Stardust.Web.csproj b/Stardust.Web/Stardust.Web.csproj index 918b0d81..218a6114 100644 --- a/Stardust.Web/Stardust.Web.csproj +++ b/Stardust.Web/Stardust.Web.csproj @@ -53,7 +53,7 @@ - + diff --git a/Stardust/Stardust.csproj b/Stardust/Stardust.csproj index dd96b044..dc515657 100644 --- a/Stardust/Stardust.csproj +++ b/Stardust/Stardust.csproj @@ -117,10 +117,10 @@ - + - + diff --git a/Test/Test.csproj b/Test/Test.csproj index d9f8d38a..f2b3d9a9 100644 --- a/Test/Test.csproj +++ b/Test/Test.csproj @@ -30,7 +30,7 @@ - +