Example #1
0
        async Task ProcessLoopAsync()
        {
            await Task.Delay(_startupDelay)
            .ConfigureAwait(false);

            while (!_stoppingCts.IsCancellationRequested)
            {
                try
                {
                    var version = await _contentSource.CheckForChangesAsync()
                                  .ConfigureAwait(false);

                    if (_classGenerator != null)
                    {
                        await _classGenerator.GenerateAndSaveIfChangedAsync(version, _contentSource)
                        .ConfigureAwait(false);
                    }
                }
                catch (Exception ex)
                {
                    _logger.LogError(ex, "Error updating content");
                }

                await Task.Delay(_interval)
                .ConfigureAwait(false);
            }
        }