コード例 #1
0
        /// <summary>
        /// 定时任务测试
        /// </summary>
        /// <param name="service"></param>
        public static void UseHangfireTest(this IServiceProvider service)
        {
            var job = service.GetService <HangfireTestJob>();

            //定期作业按指定的计划触发任务
            RecurringJob.AddOrUpdate("定时任务测试", () => job.ExecuteAsync(), JontyBlogCronType.Minute());
        }
コード例 #2
0
        /// <summary>
        /// 每日热点数据抓取
        /// </summary>
        /// <param name="context"></param>
        public static void UseHotNewsJob(this IServiceProvider service)
        {
            var job = service.GetService <HotNewsJob>();

            RecurringJob.AddOrUpdate("每日热点数据抓取", () => job.ExecuteAsync(), JontyBlogCronType.Hour(1, 2));
        }
コード例 #3
0
        /// <summary>
        /// 壁纸数据抓取
        /// </summary>
        /// <param name="service"></param>
        public static void UseWallpaperJob(this IServiceProvider service)
        {
            var job = service.GetService <WallpaperJob>();

            RecurringJob.AddOrUpdate("壁纸数据抓取", () => job.ExecuteAsync(), JontyBlogCronType.Hour(1, 3));
        }