diff --git a/MergerLogic/Clients/HeartbeatClient.cs b/MergerLogic/Clients/HeartbeatClient.cs index 4160e4e6..076b4bee 100644 --- a/MergerLogic/Clients/HeartbeatClient.cs +++ b/MergerLogic/Clients/HeartbeatClient.cs @@ -84,8 +84,9 @@ public void Send(object? sender, ElapsedEventArgs elapsedEventArgs) } catch (Exception e) { + // Elapsed runs on a timer thread; the Timer discards anything thrown here and an + // unhandled exception can tear down the process. Log and let the next tick retry. this._logger.LogError($"[{MethodBase.GetCurrentMethod().Name}] Could not send heartbeat for task={this._taskId}, {e.Message}"); - throw; } } } diff --git a/MergerLogic/Clients/S3Client.cs b/MergerLogic/Clients/S3Client.cs index f06c0e23..78ca6097 100644 --- a/MergerLogic/Clients/S3Client.cs +++ b/MergerLogic/Clients/S3Client.cs @@ -75,7 +75,7 @@ private bool IsKeyError(Exception e) return null; } // In case there are other errors such as connection to S3 - throw e; + throw; } } @@ -169,7 +169,7 @@ public void UpdateTile(Tile tile) return null; } // In case there are other errors such as connection to S3 - throw e; + throw; } } } diff --git a/MergerLogic/DataTypes/Fs.cs b/MergerLogic/DataTypes/Fs.cs index 3fd4ca50..73e168bc 100644 --- a/MergerLogic/DataTypes/Fs.cs +++ b/MergerLogic/DataTypes/Fs.cs @@ -16,7 +16,7 @@ public class FS : Data private IFileSystem _fileSystem; private readonly string[] _supportedFileExtensions = { ".png", ".jpg", ".jpeg" }; - static readonly object _locker = new object(); + private readonly object _locker = new object(); public FS(IPathUtils pathUtils, IServiceProvider container, string path, int batchSize, Grid? grid, GridOrigin? origin, bool isBase = false) : base(container, DataType.FOLDER, path, batchSize, grid, origin, isBase) diff --git a/MergerLogic/DataTypes/Gpkg.cs b/MergerLogic/DataTypes/Gpkg.cs index 9b1af8cf..d70f2a3a 100644 --- a/MergerLogic/DataTypes/Gpkg.cs +++ b/MergerLogic/DataTypes/Gpkg.cs @@ -11,7 +11,7 @@ public class Gpkg : Data private long _offset; private Extent _extent; private readonly IConfigurationManager _configManager; - static readonly object _locker = new object(); + private readonly object _locker = new object(); public Gpkg(IConfigurationManager configuration, IServiceProvider container, string path, int batchSize, Grid? grid, GridOrigin? origin, bool isBase = false, Extent? extent = null) diff --git a/MergerLogic/DataTypes/S3.cs b/MergerLogic/DataTypes/S3.cs index 84cdd79e..dd555740 100644 --- a/MergerLogic/DataTypes/S3.cs +++ b/MergerLogic/DataTypes/S3.cs @@ -17,7 +17,7 @@ public class S3 : Data private IEnumerator _zoomEnumerator; private string? _continuationToken; private bool _endOfRead; - static readonly object _locker = new object(); + private readonly object _locker = new object(); private const string nullStringValue = "Null"; private readonly IPathUtils _pathUtils; diff --git a/MergerLogic/Utils/ConfigurationManager.cs b/MergerLogic/Utils/ConfigurationManager.cs index 983ee679..1952014f 100644 --- a/MergerLogic/Utils/ConfigurationManager.cs +++ b/MergerLogic/Utils/ConfigurationManager.cs @@ -25,12 +25,8 @@ public ConfigurationManager(ILogger? logger) public IEnumerable GetChildren(params string[] configPath) { - var config = this.config.GetSection(configPath[0]); - for (int i = 1; i < configPath.Length - 1; i++) - { - config = this.config.GetSection(configPath[i]); - } - return config.GetSection(configPath[configPath.Length - 1]).GetChildren(); + string key = string.Join(":", configPath); + return this.config.GetSection(key).GetChildren(); } public string GetConfiguration(params string[] configPath)