12345678910111213141516171819202122232425262728293031323334353637 |
- using DW5S.DTO;
- namespace AdService.Service
- {
- /// <summary>
- /// 服务上报服务(3s)
- /// </summary>
- public class AdReportService : BackgroundService
- {
- /// <summary>
- /// 服务上报服务
- /// </summary>
- protected override async Task ExecuteAsync(CancellationToken stoppingToken)
- {
-
- await Task.Run(async () =>
- {
- while (!stoppingToken.IsCancellationRequested)
- {
- SvrStateReportDto dto = new SvrStateReportDto()
- {
- DD = TimeSpan.FromSeconds(1),
- SvrType = EnumSvrType.AdCgSvr,
- SvrID = "AdService",
- BaseHttpAddr = "",
- SwaggerAddr="",
- ReportType = 0,
- };
- var res = await HttpHelper.PostRequestAsync<CpuCgResDto>("" + "SvrReport/Report", dto);
- await Task.Delay(3 * 1000, stoppingToken);
- }
- }, stoppingToken);
- }
- }
- }
|