From 0c82a6a69f4063aa66ce7fed4b97d6fc09eb326a Mon Sep 17 00:00:00 2001 From: Kruzya Date: Mon, 2 Mar 2020 17:07:26 +0400 Subject: [PATCH] Core bug fixes and improvements --- Core/Extensions/StartupExtension.cs | 4 +--- Core/Service/AbstractTimedHostedService.cs | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Core/Extensions/StartupExtension.cs b/Core/Extensions/StartupExtension.cs index 66c357a..cbbbfbd 100644 --- a/Core/Extensions/StartupExtension.cs +++ b/Core/Extensions/StartupExtension.cs @@ -6,8 +6,6 @@ namespace Kruzya.TelegramBot.Core.Extensions public static class StartupExtension { public static IServiceCollection AddQueue(this IServiceCollection collection) - { - return collection.AddSingleton>(); - } + => collection.AddSingleton>(); } } \ No newline at end of file diff --git a/Core/Service/AbstractTimedHostedService.cs b/Core/Service/AbstractTimedHostedService.cs index 30a784c..7566bdd 100644 --- a/Core/Service/AbstractTimedHostedService.cs +++ b/Core/Service/AbstractTimedHostedService.cs @@ -29,7 +29,7 @@ namespace Kruzya.TelegramBot.Core.Service public Task StartAsync(CancellationToken cancellationToken) { _logger.LogInformation("Message sender service is starting."); - _timer = new Timer(Run, null, TimeSpan.Zero, TimeSpan.FromSeconds(1)); + _timer = new Timer(Run, null, TimeSpan.Zero, TimerPeriod); return Task.CompletedTask; } @@ -63,7 +63,7 @@ namespace Kruzya.TelegramBot.Core.Service } finally { - var timerPeriod = this.TimerPeriod; + var timerPeriod = TimerPeriod; _timer?.Change(timerPeriod, timerPeriod); } }