diff --git a/Dodo1000Bot.Api/DependencyModules/JobsRegistration.cs b/Dodo1000Bot.Api/DependencyModules/JobsRegistration.cs index e49ed4f..a103b1a 100644 --- a/Dodo1000Bot.Api/DependencyModules/JobsRegistration.cs +++ b/Dodo1000Bot.Api/DependencyModules/JobsRegistration.cs @@ -1,4 +1,6 @@ +using System.Threading.Channels; using Dodo1000Bot.Api.Jobs; +using Dodo1000Bot.Models.Domain; using Dodo1000Bot.Services.Configuration; using Microsoft.Extensions.DependencyInjection; @@ -11,8 +13,22 @@ internal static void AddJobs(this IServiceCollection services, AppConfiguration services.AddHostedService(serviceProvider => new MigrationsJob(appConfiguration.MysqlConnectionString, serviceProvider)); services.AddHostedService(); services.AddHostedService(); + services.AddHostedService(); services.AddHostedService(); services.AddHostedService(); + + var channelOptions = new BoundedChannelOptions(1_000) + { + FullMode = BoundedChannelFullMode.DropWrite, + SingleReader = true, + SingleWriter = true + }; + var channel = Channel.CreateBounded(channelOptions); + + services.AddSingleton>(channel); + services.AddSingleton>(channel); + + services.AddHostedService(); } } \ No newline at end of file