protected override async Task ExecuteAsync(CancellationToken stoppingToken) { while (!stoppingToken.IsCancellationRequested) { _logger.LogInformation($"Worker running at {DateTime.Now}"); foreach (var weather in await _weatherRepository.GetAll()) { _logger.LogInformation($"removing {weather.Id}"); await _weatherRepository.Delete(weather.Id); await Task.Delay(TimeSpan.FromSeconds(2), stoppingToken); } await Task.Delay(TimeSpan.FromSeconds(30), stoppingToken); } }