2020-08-09 02:26:41 +02:00
|
|
|
|
namespace Giants.Services
|
2020-08-09 01:31:16 +02:00
|
|
|
|
{
|
2020-08-09 02:26:41 +02:00
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Microsoft.Extensions.Hosting;
|
|
|
|
|
|
2020-08-09 01:31:16 +02:00
|
|
|
|
public class InitializerHostedService : IHostedService
|
|
|
|
|
{
|
|
|
|
|
private readonly IServerRegistryStore serverRegistryStore;
|
|
|
|
|
|
|
|
|
|
public InitializerHostedService(IServerRegistryStore serverRegistryStore)
|
|
|
|
|
{
|
|
|
|
|
this.serverRegistryStore = serverRegistryStore;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async Task StartAsync(CancellationToken cancellationToken)
|
|
|
|
|
{
|
|
|
|
|
await this.serverRegistryStore.Initialize();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Task StopAsync(CancellationToken cancellationToken)
|
|
|
|
|
{
|
|
|
|
|
return Task.CompletedTask;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|