34 lines
945 B
C#
34 lines
945 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
using Microsoft.Extensions.Hosting;
|
|
using Microsoft.Extensions.Logging;
|
|
using Squirrowse.Client.Service;
|
|
|
|
namespace Squirrowse.Client
|
|
{
|
|
public class Worker : BackgroundService
|
|
{
|
|
private readonly ILogger<Worker> _logger;
|
|
private readonly IStreamService _streamService;
|
|
|
|
public Worker(ILogger<Worker> logger, IStreamService streamService)
|
|
{
|
|
_logger = logger;
|
|
_streamService = streamService;
|
|
}
|
|
|
|
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
|
{
|
|
while (!stoppingToken.IsCancellationRequested)
|
|
{
|
|
_logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now);
|
|
|
|
await Task.Delay(1000, stoppingToken);
|
|
}
|
|
}
|
|
}
|
|
}
|