Move workers
This commit is contained in:
29
src/Managing.Application/Workers/LeaderboardWorker.cs
Normal file
29
src/Managing.Application/Workers/LeaderboardWorker.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using Managing.Application.Abstractions.Services;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using static Managing.Common.Enums;
|
||||
|
||||
namespace Managing.Application.Workers;
|
||||
|
||||
public class LeaderboardWorker : BaseWorker<LeaderboardWorker>
|
||||
{
|
||||
private readonly IStatisticService _statisticService;
|
||||
private static readonly WorkerType _workerType = WorkerType.LeaderboardWorker;
|
||||
|
||||
public LeaderboardWorker(
|
||||
ILogger<LeaderboardWorker> logger,
|
||||
IServiceProvider serviceProvider,
|
||||
IStatisticService statisticService) : base(
|
||||
_workerType,
|
||||
logger,
|
||||
TimeSpan.FromHours(24),
|
||||
serviceProvider
|
||||
)
|
||||
{
|
||||
_statisticService = statisticService;
|
||||
}
|
||||
|
||||
protected override async Task Run(CancellationToken cancellationToken)
|
||||
{
|
||||
await _statisticService.UpdateLeaderboard();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user