diff --git a/ClientTest/ClientTest.csproj b/ClientTest/ClientTest.csproj index 102b17dc..68b59518 100644 --- a/ClientTest/ClientTest.csproj +++ b/ClientTest/ClientTest.csproj @@ -21,7 +21,7 @@ - + diff --git a/Samples/TestA/TestA.csproj b/Samples/TestA/TestA.csproj index 6156c996..7b78a8f3 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 bad7be88..366deb42 100644 --- a/Samples/TestB/TestB.csproj +++ b/Samples/TestB/TestB.csproj @@ -18,7 +18,7 @@ - + diff --git a/Stardust.Server/Services/NodeService.cs b/Stardust.Server/Services/NodeService.cs index 8d91ec0d..7b724c2b 100644 --- a/Stardust.Server/Services/NodeService.cs +++ b/Stardust.Server/Services/NodeService.cs @@ -735,6 +735,7 @@ public async Task SendCommand(Node node, CommandInModel model, Stri TraceId = DefaultSpan.Current?.TraceId, CreateUser = createUser, }; + if (model.StartTime > 0) cmd.StartTime = DateTime.Now.AddSeconds(model.StartTime); if (model.Expire > 0) cmd.Expire = DateTime.Now.AddSeconds(model.Expire); cmd.Insert(); diff --git a/Stardust.Server/Services/RegistryService.cs b/Stardust.Server/Services/RegistryService.cs index bb475658..df0092c6 100644 --- a/Stardust.Server/Services/RegistryService.cs +++ b/Stardust.Server/Services/RegistryService.cs @@ -456,6 +456,7 @@ public async Task SendCommand(App app, CommandInModel model, String CreateUser = user, }; + if (model.StartTime > 0) cmd.StartTime = DateTime.Now.AddSeconds(model.StartTime); if (model.Expire > 0) cmd.Expire = DateTime.Now.AddSeconds(model.Expire); cmd.Insert(); diff --git a/Stardust.Server/Stardust.Server.csproj b/Stardust.Server/Stardust.Server.csproj index 906d2d45..dbcd59f4 100644 --- a/Stardust.Server/Stardust.Server.csproj +++ b/Stardust.Server/Stardust.Server.csproj @@ -45,8 +45,8 @@ - - + + diff --git a/Stardust.Web/Areas/Nodes/Controllers/NodeFrameworkController.cs b/Stardust.Web/Areas/Nodes/Controllers/NodeFrameworkController.cs index 2d3af567..f8a83f10 100644 --- a/Stardust.Web/Areas/Nodes/Controllers/NodeFrameworkController.cs +++ b/Stardust.Web/Areas/Nodes/Controllers/NodeFrameworkController.cs @@ -84,7 +84,7 @@ public async Task InstallFramework(String ver, String baseUrl) var node = bf.FindByKey(item.ToInt()); if (node != null && !node.Code.IsNullOrEmpty()) { - ts.Add(_starFactory.SendNodeCommand(node.Code, "framework/install", args, 30 * 24 * 3600, 0)); + ts.Add(_starFactory.SendNodeCommand(node.Code, "framework/install", args, 0, 30 * 24 * 3600, 0)); } } @@ -102,7 +102,7 @@ public async Task UninstallFramework(String ver) if (ver.IsNullOrEmpty()) throw new ArgumentNullException(nameof(ver)); ver = ver.Trim(); - + var bf = new BatchFinder(); bf.Add(SelectKeys.Select(e => e.ToInt())); @@ -115,7 +115,7 @@ public async Task UninstallFramework(String ver) var node = bf.FindByKey(item.ToInt()); if (node != null && !node.Code.IsNullOrEmpty()) { - ts.Add(_starFactory.SendNodeCommand(node.Code, "framework/uninstall", args, 30 * 24 * 3600, 0)); + ts.Add(_starFactory.SendNodeCommand(node.Code, "framework/uninstall", args, 0, 30 * 24 * 3600, 0)); } } diff --git a/Stardust.Web/Areas/Nodes/Controllers/NodeOnlineController.cs b/Stardust.Web/Areas/Nodes/Controllers/NodeOnlineController.cs index 78ec4e9c..527eaec3 100644 --- a/Stardust.Web/Areas/Nodes/Controllers/NodeOnlineController.cs +++ b/Stardust.Web/Areas/Nodes/Controllers/NodeOnlineController.cs @@ -125,7 +125,7 @@ public async Task CheckUpgrade() var online = NodeOnline.FindById(item.ToInt()); if (online?.Node != null) { - ts.Add(_starFactory.SendNodeCommand(online.Node.Code, "node/upgrade", null, 600, 0)); + ts.Add(_starFactory.SendNodeCommand(online.Node.Code, "node/upgrade", null, 0, 600, 0)); } } @@ -144,7 +144,7 @@ public async Task Restart() var online = NodeOnline.FindById(item.ToInt()); if (online?.Node != null) { - ts.Add(_starFactory.SendNodeCommand(online.Node.Code, "node/restart", null, 600, 0)); + ts.Add(_starFactory.SendNodeCommand(online.Node.Code, "node/restart", null, 0, 600, 0)); } } @@ -163,7 +163,7 @@ public async Task Reboot() var online = NodeOnline.FindById(item.ToInt()); if (online?.Node != null) { - ts.Add(_starFactory.SendNodeCommand(online.Node.Code, "node/reboot", null, 600, 0)); + ts.Add(_starFactory.SendNodeCommand(online.Node.Code, "node/reboot", null, 0, 600, 0)); } } @@ -185,7 +185,7 @@ public async Task Execute(String command, String argument) var online = NodeOnline.FindById(item.ToInt()); if (online != null && online.Node != null) { - ts.Add(_starFactory.SendNodeCommand(online.Node.Code, command, argument, 30, 0)); + ts.Add(_starFactory.SendNodeCommand(online.Node.Code, command, argument, 0, 30, 0)); } } diff --git a/Stardust.Web/Areas/Registry/Controllers/AppOnlineController.cs b/Stardust.Web/Areas/Registry/Controllers/AppOnlineController.cs index ed097960..a52b57e9 100644 --- a/Stardust.Web/Areas/Registry/Controllers/AppOnlineController.cs +++ b/Stardust.Web/Areas/Registry/Controllers/AppOnlineController.cs @@ -127,7 +127,7 @@ public async Task Execute(String command, String argument) var online = AppOnline.FindById(item.ToInt()); if (online != null && online.App != null) { - ts.Add(_starFactory.SendAppCommand(online.App.Name, command, argument, 30, 0)); + ts.Add(_starFactory.SendAppCommand(online.App.Name, command, argument, 0, 30, 0)); } } @@ -146,7 +146,7 @@ public async Task FreeMemory() var online = AppOnline.FindById(item.ToInt()); if (online != null && online.App != null) { - ts.Add(_starFactory.SendAppCommand(online.App.Name, "app/freeMemory", null, 30, 0)); + ts.Add(_starFactory.SendAppCommand(online.App.Name, "app/freeMemory", null, 0, 30, 0)); } } diff --git a/Stardust.Web/Services/DeployService.cs b/Stardust.Web/Services/DeployService.cs index b4e3e681..453814db 100644 --- a/Stardust.Web/Services/DeployService.cs +++ b/Stardust.Web/Services/DeployService.cs @@ -56,7 +56,7 @@ public async Task Control(AppDeploy app, AppDeployNode deployNode, String action var args = new { deployNode.Id, deployNode.DeployName, AppName = deployNode.DeployName }.ToJson(); msg = args; - await _starFactory.SendNodeCommand(deployNode.Node.Code, action, args, 60, timeout); + await _starFactory.SendNodeCommand(deployNode.Node.Code, action, args, deployNode.Delay, 60, timeout); } catch (Exception ex) { diff --git a/Stardust.Web/Stardust.Web.csproj b/Stardust.Web/Stardust.Web.csproj index 5962686a..73cc2e44 100644 --- a/Stardust.Web/Stardust.Web.csproj +++ b/Stardust.Web/Stardust.Web.csproj @@ -52,8 +52,8 @@ - - + + diff --git a/Stardust/StarFactory.cs b/Stardust/StarFactory.cs index 199523c5..47c59997 100644 --- a/Stardust/StarFactory.cs +++ b/Stardust/StarFactory.cs @@ -453,10 +453,11 @@ public IRegistry? Service /// /// /// + /// /// /// /// - public async Task SendNodeCommand(String nodeCode, String command, String? argument = null, Int32 expire = 3600, Int32 timeout = 5) + public async Task SendNodeCommand(String nodeCode, String command, String? argument = null, Int32 startTime = 0, Int32 expire = 3600, Int32 timeout = 5) { if (!Valid()) return -1; @@ -465,6 +466,7 @@ public async Task SendNodeCommand(String nodeCode, String command, String Code = nodeCode, Command = command, Argument = argument, + StartTime = startTime, Expire = expire, Timeout = timeout }); @@ -474,10 +476,11 @@ public async Task SendNodeCommand(String nodeCode, String command, String /// /// /// + /// /// /// /// - public async Task SendAppCommand(String appId, String command, String? argument = null, Int32 expire = 3600, Int32 timeout = 5) + public async Task SendAppCommand(String appId, String command, String? argument = null, Int32 startTime = 0, Int32 expire = 3600, Int32 timeout = 5) { if (!Valid()) return -1; @@ -486,6 +489,7 @@ public async Task SendAppCommand(String appId, String command, String? ar Code = appId, Command = command, Argument = argument, + StartTime = startTime, Expire = expire, Timeout = timeout }); diff --git a/Stardust/Stardust.csproj b/Stardust/Stardust.csproj index 07d4cbef..222a88c3 100644 --- a/Stardust/Stardust.csproj +++ b/Stardust/Stardust.csproj @@ -112,10 +112,10 @@ - + - + diff --git a/Test/Test.csproj b/Test/Test.csproj index b9a5643d..7f6b4c87 100644 --- a/Test/Test.csproj +++ b/Test/Test.csproj @@ -30,7 +30,7 @@ - +