hangfire延迟任务修改的问题

2019-02-20 09:44发布

问题:

在使用hangfire中遇到了一个问题,使用

var jobId = BackgroundJob.Schedule(
    () => Console.WriteLine("Delayed!"),
    TimeSpan.FromDays(7));

现在得到这个jobId后,想修改这个任务的延迟时间,该如何操作呢?
劳烦指教,不胜感激!

回答1:

var jobId = BackgroundJob.Schedule(() => Console.WriteLine("Delayed!"),TimeSpan.FromDays(7));
BackgroundJob.Delete(jobId);
string rescheduleJobId = BackgroundJob.Schedule(() => Console.WriteLine("Hello, world!"),TimeSpan.FromMinutes(5));


回答2:

何不取消任务重新调度



标签: hangfire