2019-10-31 13:08:42 +01:00
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Threading;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using Microsoft.Extensions.Hosting;
|
|
|
|
using Microsoft.Extensions.Logging;
|
2019-11-01 19:04:24 +01:00
|
|
|
using Squirrowse.Client.Service;
|
2019-10-31 13:08:42 +01:00
|
|
|
|
|
|
|
namespace Squirrowse.Client
|
|
|
|
{
|
|
|
|
public class Worker : BackgroundService
|
|
|
|
{
|
|
|
|
private readonly ILogger<Worker> _logger;
|
2019-11-01 19:04:24 +01:00
|
|
|
private readonly IStreamService _streamService;
|
2019-10-31 13:08:42 +01:00
|
|
|
|
2019-11-01 19:04:24 +01:00
|
|
|
public Worker(ILogger<Worker> logger, IStreamService streamService)
|
2019-10-31 13:08:42 +01:00
|
|
|
{
|
|
|
|
_logger = logger;
|
2019-11-01 19:04:24 +01:00
|
|
|
_streamService = streamService;
|
2019-10-31 13:08:42 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
|
|
|
{
|
|
|
|
while (!stoppingToken.IsCancellationRequested)
|
|
|
|
{
|
|
|
|
_logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now);
|
2019-11-01 19:04:24 +01:00
|
|
|
|
2019-10-31 13:08:42 +01:00
|
|
|
await Task.Delay(1000, stoppingToken);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|