Core bug fixes and improvements

This commit is contained in:
2020-03-02 17:07:26 +04:00
parent dc2307d74e
commit 0c82a6a69f
2 changed files with 3 additions and 5 deletions
+1 -3
View File
@@ -6,8 +6,6 @@ namespace Kruzya.TelegramBot.Core.Extensions
public static class StartupExtension
{
public static IServiceCollection AddQueue<T>(this IServiceCollection collection)
{
return collection.AddSingleton<ConcurrentQueue<T>>();
}
=> collection.AddSingleton<ConcurrentQueue<T>>();
}
}
+2 -2
View File
@@ -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);
}
}