Skip to content

Commit

Permalink
Some cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
einarmo committed Feb 28, 2025
1 parent 28dae6c commit 76aabe9
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions ExtractorUtils/Unstable/Configuration/ConfigSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -195,16 +195,6 @@ public async Task<bool> ResolveLocalConfig(BaseErrorReporter reporter, Cancellat
return true;
}

private Task<string> LoadLocalBufferFile(string path)
{
if (_bufferFilePath == null) throw new InvalidOperationException("Attempt to read local buffer file when no buffer file is configured");
using var reader = new StreamReader(_bufferFilePath);

#pragma warning disable CA2016 // Forward the 'CancellationToken' parameter to methods. Not in .NET standard 2.0
return reader.ReadToEndAsync();
#pragma warning restore CA2016 // Forward the 'CancellationToken' parameter to methods
}

/// <summary>
/// Load configuration from CDF.
/// Returns whether we have loaded a new config file.
Expand Down Expand Up @@ -280,14 +270,11 @@ private async Task<string> ReadLocalFile(string path)
if (_bufferFilePath != null)
{
if (!System.IO.File.Exists(_bufferFilePath)) throw new ConfigurationException($"Could not retrieve remote configuration, and local buffer does not exist: {ex.Message}", ex);
using var reader = new StreamReader(_bufferFilePath);
#pragma warning disable CA2016 // Forward the 'CancellationToken' parameter to methods. Not in .NET standard 2.0
var text = await reader.ReadToEndAsync().ConfigureAwait(false);
#pragma warning restore CA2016 // Forward the 'CancellationToken' parameter to methods
var bufferText = await ReadLocalFile(_bufferFilePath).ConfigureAwait(false);

_logger.LogWarning("Loaded configuration from local config file buffer.");

return (text, null);
return (bufferText, null);
}
throw new ConfigurationException($"Could not retrieve remote configuration: {ex.Message}", ex);
}
Expand Down

0 comments on commit 76aabe9

Please sign in to comment.