James Tombleson
adb4799206
* Added jobs Controller to trigger collection. * Added backgroundjobs to move them out of program.cs * new column to track youtube ID values and adding a sourceid column on the icon for linking * Added icon table repo * added interface for IconsRepo * hey the missing config models * adding section const keys to pull blocks of configs * Added youtubewatcher to the code but not ready to enable it in the background. More testing needed. * Test... improvements?
26 lines
1.1 KiB
C#
26 lines
1.1 KiB
C#
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<RssWatcherJob>("RSS", x => x.InitAndExecute(new RssWatcherJobOptions
|
|
{
|
|
ConnectionStrings =
|
|
configuration.GetValue<ConfigSectionConnectionStrings>(ConfigSectionsConst.ConnectionStrings),
|
|
Config = configuration.GetValue<ConfigSectionRssModel>(ConfigSectionsConst.Rss)
|
|
}), "15 0-23 * * *");
|
|
|
|
RecurringJob.AddOrUpdate<DiscordNotificationJob>("Discord Alerts", x =>
|
|
x.InitAndExecute(new DiscordNotificationJobOptions
|
|
{
|
|
ConnectionStrings = configuration.GetValue<ConfigSectionConnectionStrings>(ConfigSectionsConst.ConnectionStrings),
|
|
Config = configuration.GetValue<ConfigSectionNotificationsDiscord>(ConfigSectionsConst.NotificationsDiscord)
|
|
}), "5/10 * * * *");
|
|
}
|
|
} |