remove default Worker
This commit is contained in:
@@ -52,7 +52,6 @@ try
|
|||||||
builder.Configuration.GetSection("EmailAccount"));
|
builder.Configuration.GetSection("EmailAccount"));
|
||||||
|
|
||||||
// Register Background Workers
|
// Register Background Workers
|
||||||
builder.Services.AddHostedService<Worker>();
|
|
||||||
builder.Services.AddHostedService<EmailSenderWorker>();
|
builder.Services.AddHostedService<EmailSenderWorker>();
|
||||||
|
|
||||||
builder.Services.AddControllers();
|
builder.Services.AddControllers();
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
namespace DigitalData.EmailProfiler.API;
|
|
||||||
|
|
||||||
public class Worker(ILogger<Worker> Logger) : BackgroundService
|
|
||||||
{
|
|
||||||
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
|
|
||||||
{
|
|
||||||
while (!stoppingToken.IsCancellationRequested)
|
|
||||||
{
|
|
||||||
if (Logger.IsEnabled(LogLevel.Information))
|
|
||||||
{
|
|
||||||
Logger.LogInformation("Worker running at: {time}", DateTimeOffset.Now);
|
|
||||||
}
|
|
||||||
await Task.Delay(1000, stoppingToken);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user