using Hangfire; using Newsbot.Collector.Domain.Consts; using Newsbot.Collector.Domain.Models.Config; using Newsbot.Collector.Services.Jobs; namespace Newsbot.Collector.Api; public class BackgroundJobs { public static void SetupRecurringJobs(IConfiguration configuration) { RecurringJob.AddOrUpdate("RSS", x => x.InitAndExecute(new RssWatcherJobOptions { ConnectionStrings = configuration.GetValue(ConfigSectionsConst.ConnectionStrings), Config = configuration.GetValue(ConfigSectionsConst.Rss) }), "15 0-23 * * *"); RecurringJob.AddOrUpdate("Discord Alerts", x => x.InitAndExecute(new DiscordNotificationJobOptions { ConnectionStrings = configuration.GetValue(ConfigSectionsConst.ConnectionStrings), Config = configuration.GetValue(ConfigSectionsConst.NotificationsDiscord) }), "5/10 * * * *"); } }