From 6a629ab9334f20a1094ea5e1b91428dac013f81c Mon Sep 17 00:00:00 2001 From: "yongen.loong" Date: Thu, 10 Oct 2024 12:10:34 +0800 Subject: [PATCH 1/2] feat: limit to 10 concurrent builds per silo --- PlaygroundService/Grains/PlaygroundGrain.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/PlaygroundService/Grains/PlaygroundGrain.cs b/PlaygroundService/Grains/PlaygroundGrain.cs index f78f50c..6ddd725 100644 --- a/PlaygroundService/Grains/PlaygroundGrain.cs +++ b/PlaygroundService/Grains/PlaygroundGrain.cs @@ -9,10 +9,13 @@ using System.Threading.Tasks; using Microsoft.Extensions.Logging; using Orleans; +using Orleans.Concurrency; using PlaygroundService.Dtos; using PlaygroundService.Utilities; namespace PlaygroundService.Grains; + +[StatelessWorker(10)] // max 10 activations per silo public class PlaygroundGrain : Grain, IPlaygroundGrain { private readonly ILogger _logger; From a7dfe470e614f58de68fa0ca28e743d29dd4c425 Mon Sep 17 00:00:00 2001 From: "yongen.loong" Date: Thu, 10 Oct 2024 12:24:05 +0800 Subject: [PATCH 2/2] fix: grain methods should be async --- PlaygroundService/Grains/PlaygroundGrain.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PlaygroundService/Grains/PlaygroundGrain.cs b/PlaygroundService/Grains/PlaygroundGrain.cs index 6ddd725..c73d453 100644 --- a/PlaygroundService/Grains/PlaygroundGrain.cs +++ b/PlaygroundService/Grains/PlaygroundGrain.cs @@ -97,7 +97,7 @@ public async Task> GetTemplates() process.Start(); // start process // If necessary,can read the output of the process // string output = process.StandardOutput.ReadToEnd(); - process.WaitForExit(); // Waiting for process to exit + await process.WaitForExitAsync(); // Waiting for process to exit } _logger.LogInformation("PlayGroundGrain GenerateZip dotnet new end command: " + command + " time: " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));