From a4a79de663df1c810c39e8deb10f94e157905d3d Mon Sep 17 00:00:00 2001 From: H Vs Date: Wed, 28 Jun 2023 16:28:26 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4worker?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HealthMonitor.WebApi/Dockerfile | 2 +- .../Properties/launchSettings.json | 5 +++-- HealthMonitor.WebApi/Worker.cs | 15 ++++++++++----- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/HealthMonitor.WebApi/Dockerfile b/HealthMonitor.WebApi/Dockerfile index 4ed6945..0b204e2 100644 --- a/HealthMonitor.WebApi/Dockerfile +++ b/HealthMonitor.WebApi/Dockerfile @@ -42,5 +42,5 @@ ENV LANG C.UTF-8 RUN ln -snf /usr/share/zoneinfo/$TimeZone /etc/localtime && echo $TimeZone > /etc/timezone #ENTRYPOINT dotnet HealthMonitor.WebApi.dll --environment=$environment -ENTRYPOINT ["dotnet", "HealthMonitor.WebAapi.dll"] +ENTRYPOINT ["dotnet", "HealthMonitor.WebApi.dll"] CMD ["--environment=Development"] \ No newline at end of file diff --git a/HealthMonitor.WebApi/Properties/launchSettings.json b/HealthMonitor.WebApi/Properties/launchSettings.json index 5077478..cbd8185 100644 --- a/HealthMonitor.WebApi/Properties/launchSettings.json +++ b/HealthMonitor.WebApi/Properties/launchSettings.json @@ -13,8 +13,9 @@ "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": true, - // "launchUrl": "swagger", - "applicationUrl": "https://localhost:7149;http://localhost:5083", + // "launchUrl": "swagger", + //"applicationUrl": "https://localhost:7149;http://localhost:5083", + "applicationUrl": "http://localhost:6899", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } diff --git a/HealthMonitor.WebApi/Worker.cs b/HealthMonitor.WebApi/Worker.cs index 716b46e..a459e21 100644 --- a/HealthMonitor.WebApi/Worker.cs +++ b/HealthMonitor.WebApi/Worker.cs @@ -43,7 +43,7 @@ namespace HealthMonitor.WebApi protected override Task ExecuteAsync(CancellationToken stoppingToken) { - // var processor = _services.GetService(); + // var processor = _services.GetService(); TaskFactory factory = new(_tokenSource.Token); factory.StartNew(async () => { @@ -52,16 +52,21 @@ namespace HealthMonitor.WebApi while (!_tokenSource.IsCancellationRequested) { + await _processor.ResolveAsync().ConfigureAwait(false); - // await _tdEngineDataSubcribe.ProcessMsg(); + // await _tdEngineDataSubcribe.ProcessMsg(); } }, TaskCreationOptions.LongRunning); - while (!_tokenSource.IsCancellationRequested) + factory.StartNew(() => { - _tdEngineDataSubcribe.BeginListen(_tokenSource.Token); - } + while (!_tokenSource.IsCancellationRequested) + { + _tdEngineDataSubcribe.BeginListen(_tokenSource.Token); + } + }, TaskCreationOptions.LongRunning); + return Task.Delay(1000, _tokenSource.Token); }