瀏覽代碼

调整worker

td_orm
H Vs 1 年之前
父節點
當前提交
a4a79de663
共有 3 個檔案被更改,包括 14 行新增8 行删除
  1. +1
    -1
      HealthMonitor.WebApi/Dockerfile
  2. +3
    -2
      HealthMonitor.WebApi/Properties/launchSettings.json
  3. +10
    -5
      HealthMonitor.WebApi/Worker.cs

+ 1
- 1
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"]

+ 3
- 2
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"
}


+ 10
- 5
HealthMonitor.WebApi/Worker.cs 查看文件

@@ -43,7 +43,7 @@ namespace HealthMonitor.WebApi

protected override Task ExecuteAsync(CancellationToken stoppingToken)
{
// var processor = _services.GetService<PackageProcess>();
// var processor = _services.GetService<PackageProcess>();
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);

}


Loading…
取消
儲存