James Tombleson
09fe274752
* New single const file for all config info * seed was updated to reflect route params * Adjusting config loads to make it easier to follow * test updates for config loading
28 lines
1.2 KiB
C#
28 lines
1.2 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 static class BackgroundJobs
|
|
{
|
|
public static void SetupRecurringJobs(IConfiguration configuration)
|
|
{
|
|
RecurringJob.AddOrUpdate<RssWatcherJob>("RSS", x =>
|
|
x.InitAndExecute(new RssWatcherJobOptions
|
|
{
|
|
ConnectionString = configuration.GetValue<string>(ConfigConst.ConnectionStringDatabase),
|
|
OpenTelemetry = configuration.GetValue<string>(ConfigConst.ConnectionStringOpenTelemetry),
|
|
IsEnabled = configuration.GetValue<bool>(ConfigConst.RedditIsEnabled)
|
|
}), "15 0-23 * * *");
|
|
|
|
RecurringJob.AddOrUpdate<DiscordNotificationJob>("Discord Alerts", x =>
|
|
x.InitAndExecute(new DiscordNotificationJobOptions
|
|
{
|
|
ConnectionString = configuration.GetValue<string>(ConfigConst.ConnectionStringDatabase),
|
|
OpenTelemetry = configuration.GetValue<string>(ConfigConst.ConnectionStringOpenTelemetry),
|
|
IsEnabled = configuration.GetValue<bool>(ConfigConst.DiscordNotificationsEnabled),
|
|
}), "5/10 * * * *");
|
|
}
|
|
} |