소스 검색

调整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…
취소
저장