使用allan的shiny framework
我已经声明了重复的任务如下:
public class RepeatedTask : IJob
{
public async Task<bool> Run(JobInfo jobInfo, CancellationToken cancelToken)
{
//do stuff
return true;
}
}启动文件如下所示
public class MyStartup : ShinyStartup
{
public static JobInfo RepeatedJob;
public override void ConfigureServices(IServiceCollection services)
{
// register your shiny services here
var job = new JobInfo(typeof(RepeatedTask))
{
Repeat = true,
PeriodicTime = DateTime.Now.ToLocalTime().TimeOfDay,
RequiredInternetAccess = InternetAccess.Any
};
RepeatedJob = job;
services.RegisterJob(job);
}
}该任务仅运行一次,
我想要无限时间重复运行任务,我该如何实现?
发布于 2020-11-11 11:24:54
在PeriodicTime上,您应该根据任务运行的时间间隔来设置TimeSpan。
最小的间隔是15分钟,显然是受android nuget的“限制”
https://stackoverflow.com/questions/64533125
复制相似问题