Fixed: Only log /proc/mounts exception once per process

Closes #4929
This commit is contained in:
Mark McDowall 2022-12-20 17:07:11 -08:00
parent 17bfcdd325
commit ce0388ca99
1 changed files with 7 additions and 1 deletions

View File

@ -27,6 +27,8 @@ namespace NzbDrone.Mono.Disk
private static Dictionary<string, bool> _fileSystems; private static Dictionary<string, bool> _fileSystems;
private bool _hasLoggedProcMountFailure = false;
public ProcMountProvider(Logger logger) public ProcMountProvider(Logger logger)
{ {
_logger = logger; _logger = logger;
@ -45,7 +47,11 @@ namespace NzbDrone.Mono.Disk
} }
catch (Exception ex) catch (Exception ex)
{ {
_logger.Debug(ex, "Failed to retrieve mounts from {0}", PROC_MOUNTS_FILENAME); if (!_hasLoggedProcMountFailure)
{
_logger.Debug(ex, "Failed to retrieve mounts from {0}", PROC_MOUNTS_FILENAME);
_hasLoggedProcMountFailure = true;
}
} }
return new List<IMount>(); return new List<IMount>();