Commit 0e797111 by 泽锋 李

fix

parent cf7b03ff
using AutoTurnOver.DB; using AutoTurnOver.DB;
using AutoTurnOver.Services;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
...@@ -14,7 +15,15 @@ namespace AutoTurnOver.DownloadService ...@@ -14,7 +15,15 @@ namespace AutoTurnOver.DownloadService
protected override Task ExecuteAsync(CancellationToken stoppingToken) protected override Task ExecuteAsync(CancellationToken stoppingToken)
{ {
_timer = new Timer(DoWork, null, TimeSpan.Zero, TimeSpan.FromMinutes(1)); Task.Factory.StartNew(async () =>
{
Console.WriteLine($"开始 下载任务 ,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
await new TaskDownloadServices().Download();
Console.WriteLine($"结束 下载任务 ,线程Id:{Thread.CurrentThread.ManagedThreadId}{DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")}");
Thread.Sleep(3 * 1000);
});
return Task.CompletedTask; return Task.CompletedTask;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment